You are viewing a single comment's thread. Return to all comments →
My ansewr in python
Q = int(input()) S = str() prev = [] operations = [] for i in range(Q): operations.append(input().split(" ")) for i, op in enumerate(operations): match op[0]: case "1": prev.append(S) S += op[1] case "2": prev.append(S) S = S[:-int(op[1])] case "3": print(S[int(op[1])-1]) case "4": S = prev[-1] prev.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 →
My ansewr in python