You are viewing a single comment's thread. Return to all comments →
if __name__ == '__main__': from collections import deque operation_count = int(input()) que = deque() for _ in range(operation_count): operation = str(input()).split(" ") if operation[0] == 'append': que.append(operation[1]) if operation[0] == 'appendleft': que.appendleft(operation[1]) if operation[0] == 'pop': que.pop() if operation[0] == 'popleft': que.popleft() for value in que: print(value, 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 →