반응형
📖 문제

📃 코드
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
'Study & Project ✏️ > 알고리즘 📋' 카테고리의 다른 글
| 프로그래머스[Python] 네트워크 - 파이썬 (0) | 2022.11.13 |
|---|---|
| 프로그래머스[Python] 타겟 넘버 - 파이썬 (0) | 2022.11.12 |
| 백준[Python] 10815.숫자 카드 - 파이썬 (0) | 2022.11.08 |
| [알고리즘] 플로이드 와샬 알고리즘 - 자바 (0) | 2022.11.06 |
| 백준[JAVA] 11279.최대 힙 - 자바 (0) | 2022.11.05 |