You are viewing a single comment's thread. Return to all comments →
Python 3
hist = [""] # stores history of operation. Initially empty string for i in range(int(input())): args = input().split() if args[0] == '1': hist.append(hist[-1] + args[1]) elif args[0] == '2': hist.append(hist[-1][:len(hist[-1])-int(args[1])]) elif args[0] == '3': print(hist[-1][int(args[1])-1]) else: hist.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