본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 20978번 共通要素 (Common Elements)

by 현장 2023. 7. 2.

-Code

n, m = map(int, input().split())

a_list = set(list(map(int, input().split())))
b_list = list(map(int, input().split()))

res = []

for a in a_list:
    if a in b_list:
        res.append(a)

for r in sorted(res):
    print(r)