[2023-02-18 ๐Ÿ’…๐Ÿฝ TIL ]

Burkeyยท2023๋…„ 2์›” 18์ผ
0

TIL

๋ชฉ๋ก ๋ณด๊ธฐ
35/157

๋ฐฑ์ค€ 1764๋ฒˆ ๋ฌธ์ œ

import sys

input = sys.stdin.readline

N, M = map(int, input().split())
notListen = []
notLook = {}
notListen_notLook = []

for _ in range(N):
    notListen.append(input().strip())

for _ in range(M):
    notLook[input().strip()] = 0

for i in range(N):
    if notListen[i] in notLook:
        notListen_notLook.append(notListen[i])

notListen_notLook_count = len(notListen_notLook)
notListen_notLook.sort()

print(notListen_notLook_count)
for i in range(notListen_notLook_count):
    print(notListen_notLook[i])

sys.stdin.readline๋กœ ์‚ฌ์šฉ์ž์˜ ์—ฌ๋Ÿฌ ์ค„์˜ ๋ฌธ์ž์—ด ๊ฐ’์„ ๋ฐ›์•„์˜ฌ๋•Œ์—๋Š” ๋’ค์— ์ค„๋ฐ”๊ฟˆ์ด ์ถ”๊ฐ€๋˜์–ด ์ž…๋ ฅ๋œ๋‹ค.
์ด๋ฅผ strip()์„ ์‚ฌ์šฉํ•˜์—ฌ ์ œ๊ฑฐํ•˜๋ฉด ๋œ๋‹ค.

profile
์Šคํƒฏ ์˜ฌ๋ฆฌ๋Š” ์ค‘

0๊ฐœ์˜ ๋Œ“๊ธ€