You are viewing a single comment's thread. Return to all comments →
Easy Python Solution
n = int(input().strip()) text = '' curr = [] for i in range(n): opr = input().strip().split(' '); if opr[0]=='1': text += opr[1] curr.append(text) elif opr[0]=='2': pos = len(text)-int(opr[1]) text = text[:pos] curr.append(text) elif opr[0]=='3': print(text[int(opr[1])-1]) else: curr.pop() if len(curr)!=0: text = curr[-1] else: text = ''
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 →
Easy Python Solution