「検索履歴 Python3編」回答
remove でリスト中の特定の要素を削除できる
for i in reversed(line)
でlineの要素を逆順に出力できる
# coding: utf-8 # Your code here! num = int(input()) line = [] for i in range(num): word = input() if line.count(word) == 0: line.append(word) else : line.remove(word) line.append(word) #print(line) for i in reversed(line): print(i)