8
void addText(string text) {14
int deleteText(int k) {16
while (!left.empty() and k > 0) {24
string cursorLeft(int k) {25
while (!left.empty() and k > 0) {31
// returning the last min(10, len) characters to the left of the cursor32
return cursorShiftString();35
string cursorRight(int k) {36
while (!right.empty() and k > 0) {42
// returning the last min(10, len) characters to the left of the cursor43
return cursorShiftString();46
// function to return the last min(10, len) characters to the left of the48
string cursorShiftString() {51
while (!left.empty() and cnt > 0) {57
reverse(rtn.begin(), rtn.end());58
for (int i = 0; i < rtn.size(); i++) {