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): y=input().split() if(y[0]=="append"): d.append(y[1]) elif(y[0]=="appendleft"): d.appendleft(y[1]) elif(y[0]=="pop"): d.pop() elif(y[0]=="popleft"): d.popleft() print(*d,end=" ")
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 →