0
0

レベルC復習

Posted at

A = {}
for target in input().split():
    if target not in A:
        A[target] = 1
    else:
        A[target] += 1

for word,result in (A.items()):
    print(word, result)

n = int(input())
#チェック用の配列
re = []

for i in range(n):

    s = input()
    #もしsがre配列にあれば削除
    if s in re:
        re.pop(re.index(s))
    #追加
    re.append(s)
    
#最新から順番に(通常通りではない)
for i in range(len(re)):
    print(re[-i - 1])
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0