题解 | #【模板】链表#
【模板】链表
https://www.nowcoder.com/practice/97dc1ac2311046618fd19960041e3c6f
n = int(input()) l = [] for i in range(n): a = input().split() if a[0] == "insert": x = int(a[1]) y = int(a[2]) if x in l: l.insert(l.index(x),y) else: l.append(y) if a[0] == "delete": x = int(a[1]) if x in l: l.remove(x) if len(l) == 0: print("NULL") else: for i in l: print(i, end = ' ')