백준

백준 1764번: 듣보잡 (파이썬)

inns21 2023. 7. 29. 23:03

n, m = map(int, input().split())
n_dict = dict()
m_dict = dict()
result = []
for i in range(n):
  n_dict[input()] = 0
for i in range(m):
  m_dict[input()] = 0

for i in n_dict:
  if i in m_dict:
    result.append(i)

result.sort()
print(len(result))
for i in result:
  print(i)