- 집합 자료형을 이용해서 교집합을 출력하는 intersection을 활용했다.
- intersection을 이용해서 편하게 코드를 작성했지만 시간이 많이 소요되어 별로 좋지 못한 코드라고 생각된다. 시간 문제를 해결할 수 있는 코드를 공부해봐야겠다.
N, M = map(int, input().split())
not_hear = set()
for _ in range(N):
not_hear.add(input())
not_see = set()
for _ in range(M):
not_see.add(input())
intersection = not_see.intersection(not_hear)
intersection = sorted(intersection)
print(len(intersection))
for i in intersection:
print(i)