You are viewing a single comment's thread. Return to all comments →
from collections import deque d = deque() n = int(input()) for _ in range(n): string = input().split(' ') if string[0] == "append": d.append(string[1]) elif string[0] == "appendleft": d.appendleft(string[1]) elif string[0] == "pop": d.pop() else: 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 →