Collections.deque()

  • + 0 comments

    Here is my attempt:

    from collections import deque
    
    d = deque()
    
    for _ in range(int(input())):
        op, *args = input().rsplit()
        getattr(d, op)(*args)
    
    print(*d)