You are viewing a single comment's thread. Return to all comments →
python3 solution
n = int(input()) mystring = "" history = [] for i in range(n): myinput = input().strip().split(' ') if myinput[0] == '1': history.append(mystring) mystring = mystring + myinput[1] elif myinput[0] == '2': history.append(mystring) delpos = int(myinput[1]) mypos = len(mystring) - delpos mystring = mystring[0:mypos] elif myinput[0] == '3': mypos = int(myinput[1]) - 1 print(mystring[mypos]) else: mystring = 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 →
python3 solution