You are viewing a single comment's thread. Return to all comments →
from collections import deque n = int(input()) d = deque() for _ in range(n): x =input().split() m = x[0] try: v= x[1] except Exception as e: pass
match m: case "append": d.append(v) case "appendleft": d.appendleft(v) case "pop": d.pop() case "popleft": d.popleft() case _: print(-1)
#
print(*d)
Seems like cookies are disabled on this browser, please enable them to open this website
Collections.deque()
You are viewing a single comment's thread. Return to all comments →
from collections import deque n = int(input()) d = deque() for _ in range(n): x =input().split() m = x[0] try: v= x[1] except Exception as e: pass
#
print(*d)