You are viewing a single comment's thread. Return to all comments →
Python 3:
q = int(input()) s = '' revert = [s] for _ in range(q): line = input().strip().split() operation = int(line[0]) try: argument = line[1] except Exception: pass match operation: case 1: revert.append(s) s += argument case 2: revert.append(s) for _ in range(int(argument)): s = s[:-1] case 3: print(s[int(argument)-1]) case 4: s = revert.pop()
Seems like cookies are disabled on this browser, please enable them to open this website
Simple Text Editor
You are viewing a single comment's thread. Return to all comments →
Python 3: