728x90
import sys
n = int(sys.stdin.readline())
hash = {}
for _ in range(n):
name = sys.stdin.readline().split()
if name[1] == 'enter':
hash[name[0]] = True
elif name[1] == 'leave':
hash[name[0]] = False
res = []
for key, value in hash.items():
if value == True:
res.append(key)
res.sort(reverse=True)
for i in res:
print(i)
728x90
'[PS(Problem Solving)] > [백준]' 카테고리의 다른 글
[백준] 10819 파이썬(python) : 차이를 최대로 (0) | 2022.09.13 |
---|---|
[백준] 2251 파이썬(python) : 물통 - (★) (0) | 2022.09.11 |
[백준] 5586 파이썬(python) : JOI와 IOI (0) | 2022.09.09 |
[백준] 1652 파이썬(python) : 누울 자리를 찾아라 - (★) (0) | 2022.09.07 |
[백준] 2693 파이썬(python) : N번째 큰 수 (0) | 2022.09.06 |