1
# Runtime: 1865 ms (Top 50.36%) | Memory: 27.8 MB (Top 82.98%)8
def addText(self, text: str) -> None:9
self.s = self.s[: self.cursor] + text + self.s[self.cursor :]10
self.cursor += len(text)12
def deleteText(self, k: int) -> int:13
new_cursor = max(0, self.cursor - k)14
noOfChars = k if self.cursor - k >= 0 else self.cursor15
self.s = self.s[:new_cursor] + self.s[self.cursor :]16
self.cursor = new_cursor19
def cursorLeft(self, k: int) -> str:20
self.cursor = max(0, self.cursor - k)21
start = max(0, self.cursor - 10)22
return self.s[start : self.cursor]24
def cursorRight(self, k: int) -> str:25
self.cursor = min(len(self.s), self.cursor + k)26
start = max(0, self.cursor - 10)27
return self.s[start : self.cursor]