Language: C++


import sys
#import numpy as np
from collections import deque
#import collections

N = int(input())


list = deque()

for i in range(N):
    # insert, delete, deleteFirst, deleteLast
    line = input().rstrip().split(' ')
    if line[0]=='insert':
        #list.append((int)(line[1]))
        list.appendleft((int)(line[1]))
    elif line[0]=='delete':
        try:
            list.remove((int)(line[1]))
        except ValueError:
            pass
    elif line[0]=='deleteFirst':
        list.popleft()
    elif line[0]=='deleteLast':
        list.pop()

for i in range(len(list)):
    print( (str)(list[i]), end="")
    if i != len(list)-1:
        print(" ",end="")
print()


u"""
list = []

for i in range(N):
    # insert, delete, deleteFirst, deleteLast
    line = input().rstrip().split(' ')
    if line[0]=='insert':
        #list.append((int)(line[1]))
        list.insert(0, (int)(line[1]))
    elif line[0]=='delete':
        for j in range(len(list)):
            if list[j]==(int)(line[1]):
                list.pop(j)
                break
    elif line[0]=='deleteFirst':
        list.pop(0)
    elif line[0]=='deleteLast':
        list.pop(len(list)-1)

for i in range(len(list)):
    print( (str)(list[i]), end="")
    if i != len(list)-1:
        print(" ",end="")
print()
"""



Compiler output:
a.cc:3:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
    3 | #import numpy as np
      |  ^~~~~~
a.cc:3:9: error: #import expects "FILENAME" or <FILENAME>
    3 | #import numpy as np
      |         ^~~~~
a.cc:5:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
    5 | #import collections
      |  ^~~~~~
a.cc:5:9: error: #import expects "FILENAME" or <FILENAME>
    5 | #import collections
      |         ^~~~~~~~~~~
a.cc:13:7: error: invalid preprocessing directive #insert; did you mean #assert?
   13 |     # insert, delete, deleteFirst, deleteLast
      |       ^~~~~~
      |       assert
a.cc:15:17: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   15 |     if line[0]=='insert':
      |                 ^~~~~~~~
a.cc:16:10: error: invalid preprocessing directive #list
   16 |         #list.append((int)(line[1]))
      |          ^~~~
a.cc:18:19: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   18 |     elif line[0]=='delete':
      |                   ^~~~~~~~
a.cc:23:19: warning: multi-character literal with 11 characters exceeds 'int' size of 4 bytes
   23 |     elif line[0]=='deleteFirst':
      |                   ^~~~~~~~~~~~~
a.cc:25:19: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
   25 |     elif line[0]=='deleteLast':
      |                   ^~~~~~~~~~~~
a.cc:35:4: warning: missing terminating " character
   35 | u"""
      |    ^
a.cc:35:4: error: missing terminating " character
a.cc:39:7: error: invalid preprocessing directive #insert; did you mean #assert?
   39 |     # insert, delete, deleteFirst, deleteLast
      |       ^~~~~~
      |       assert
a.cc:41:17: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   41 |     if line[0]=='insert':
      |                 ^~~~~~~~
a.cc:42:10: error: invalid preprocessing directive #list
   42 |         #list.append((int)(line[1]))
      |          ^~~~
a.cc:44:19: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   44 |     elif line[0]=='delete':
      |                   ^~~~~~~~
a.cc:49:19: warning: multi-character literal with 11 characters exceeds 'int' size of 4 bytes
   49 |     elif line[0]=='deleteFirst':
      |                   ^~~~~~~~~~~~~
a.cc:51:19: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
   51 |     elif line[0]=='deleteLast':
      |                   ^~~~~~~~~~~~
a.cc:59:3: warning: missing terminating " character
   59 | """
      |   ^
a.cc:59:3: error: missing terminating " character
a.cc:2:1: error: 'import' does not name a type
    2 | import sys
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'