You are viewing a single comment's thread. Return to all comments →
# python code Q = int(input().rstrip()) history = [] s = "" for q in range(Q): args = input().rstrip().split() cmd = args[0] if cmd == "1": history.append(s) s += args[1] if cmd == "2": history.append(s) k = int(args[1]) s = s[:-(k)] if cmd == "3": k = int(args[1]) print(s[k-1]) if cmd == "4": s = history.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 →