Study & Project ✏️/알고리즘 📋

백준[Python] 14425.문자열 집합 - 파이썬

JM 2022. 11. 8. 14:08
반응형

📖 문제

📃 코드

import sys
import collections
input = sys.stdin.readline

N, M = map(int, input().split())
strHash = collections.defaultdict(int)
cnt = 0

for _ in range(N):
    s = input().strip()
    strHash[s]

for _ in range(M):
    s = input().strip()
    if s in strHash:
        cnt += 1
print(cnt)

 

🔗 링크

https://www.acmicpc.net/problem/14425

 

14425번: 문자열 집합

첫째 줄에 문자열의 개수 N과 M (1 ≤ N ≤ 10,000, 1 ≤ M ≤ 10,000)이 주어진다.  다음 N개의 줄에는 집합 S에 포함되어 있는 문자열들이 주어진다. 다음 M개의 줄에는 검사해야 하는 문자열들이 주어

www.acmicpc.net