题解 | #从单向链表中删除指定值的节点#
从单向链表中删除指定值的节点
https://www.nowcoder.com/practice/f96cd47e812842269058d483a11ced4f
import sys
str = list(map(int, input().split()))
li = [str[1]]
x = []
y = []
n = 2
while n < len(str) - 2:
y.append(str[n])
x.append(str[n + 1])
n = n + 2
for i in range(len(x)):
index = li.index(x[i])
li.insert(index + 1, y[i])
li.remove(str[-1])
for i in li:
print(i, end=' ')
