https://www.acmicpc.net/problem/14425
14425번: 문자열 집합
첫째 줄에 문자열의 개수 N과 M (1 ≤ N ≤ 10,000, 1 ≤ M ≤ 10,000)이 주어진다. 다음 N개의 줄에는 집합 S에 포함되어 있는 문자열들이 주어진다. 다음 M개의 줄에는 검사해야 하는 문자열들이 주어
www.acmicpc.net
# 14425 - Python 3
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
s = []
for i in range(n):
x = str(input().strip())
s.append(x)
arr = []
for i in range(m):
y = str(input().strip())
arr.append(y)
cnt = 0
for i in arr: # for문을 사용하여 확인
if i in s:
cnt += 1
print(cnt)
'코딩' 카테고리의 다른 글
| [Python] 백준 #10816. 숫자 카드 2 (0) | 2023.03.18 |
|---|---|
| [Python] 백준 #1620. 나는야 포켓몬 마스터 이다솜 (0) | 2023.03.17 |
| [Python] 백준 #10815. 숫자 카드 (0) | 2023.03.17 |
| [Python] 백준 #24313. 알고리즘 수업 - 점근적 표기 1 (0) | 2023.03.13 |
| [Python] 백준 #24267. 알고리즘 수업 - 알고리즘의 수행 시간 6 (0) | 2023.03.13 |