๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
  • What would life be If we had no courage to attemp anything?
Problem Solving/BAEKJOON

[baekjoon]python #14425 ๋ฌธ์ž์—ด ์ง‘ํ•ฉ

by DevIseo 2023. 7. 16.

[baekjoon]python #14425 ๋ฌธ์ž์—ด ์ง‘ํ•ฉ

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

 

14425๋ฒˆ: ๋ฌธ์ž์—ด ์ง‘ํ•ฉ

์ฒซ์งธ ์ค„์— ๋ฌธ์ž์—ด์˜ ๊ฐœ์ˆ˜ N๊ณผ M (1 ≤ N ≤ 10,000, 1 ≤ M ≤ 10,000)์ด ์ฃผ์–ด์ง„๋‹ค.  ๋‹ค์Œ N๊ฐœ์˜ ์ค„์—๋Š” ์ง‘ํ•ฉ S์— ํฌํ•จ๋˜์–ด ์žˆ๋Š” ๋ฌธ์ž์—ด๋“ค์ด ์ฃผ์–ด์ง„๋‹ค. ๋‹ค์Œ M๊ฐœ์˜ ์ค„์—๋Š” ๊ฒ€์‚ฌํ•ด์•ผ ํ•˜๋Š” ๋ฌธ์ž์—ด๋“ค์ด ์ฃผ์–ด

www.acmicpc.net

import sys
input = sys.stdin.readline

N,M = map(int,input().split(' '))
S = [input()for _ in range(N)]
arr = [input()for _ in range(M)]

answer = 0
for a in arr:
    if a in S:
        answer+=1

print(answer)

๋Œ“๊ธ€