티스토리 뷰

📚 문제

입력

출력

예제 입력 1

5 11
baekjoononlinejudge
startlink
codeplus
sundaycoding
codingsh
baekjoon
codeplus
codeminus
startlink
starlink
sundaycoding
codingsh
codinghs
sondaycoding
startrink
icerink

예제 출력 1

4

🧑🏻‍💻 풀이 과정

  • 검사할 문자를 반복하며 하나씩 꺼내서 검사할 문자열과 일치하는 문자가 있으면 cnt를 1 증가시키자.
def set_words(check_word):
    cnt = 0
    for i, str in enumerate(check_word):
        if str in s:
            cnt += 1

    return cnt


n, m = map(int, input().split())
s = [input() for _ in range(n)]
check_word = [input() for _ in range(m)]
print(set_words(check_word))
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함