나의 코드
from collections import Counter
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
data = [input() for _ in range(n)]
s = [input() for _ in range(m)]
count = 0
data = Counter(data)
for i in s:
if data[i]:
count += 1
print(count)
풀이 방법
Collections의 Counter를 이용
'백준 알고리즘 (Baekjoon Algorithm)' 카테고리의 다른 글
[파이썬] 백준 알고리즘 No.11478 서로 다른 부분 문자열의 개수 (0) | 2023.02.18 |
---|---|
[파이썬] 백준 알고리즘 No.1269 대칭 차집합 (0) | 2023.02.18 |
[파이썬] 백준 알고리즘 No.2805 나무 자르기 (0) | 2023.02.17 |
[파이썬] 백준 알고리즘 No.1654 랜선 자르기 (0) | 2023.02.17 |
[파이썬] 백준 알고리즘 No.3055 탈출 (0) | 2023.02.10 |