백준 11587번: MARKO #Python

ColorlessDia·2026년 2월 28일

algorithm/baekjoon

목록 보기
833/836
import sys

input = sys.stdin.readline

k = [chr(i) for i in range(ord('a'), ord('z') + 1)]
v = '22233344455566677778889999'
matched_char = dict(zip(k, v))

N = int(input())

word_list = [input().rstrip() for _ in range(N)]
S = input().rstrip()

length = len(S)
count = 0

for word in word_list:

    if len(word) != length:
        continue

    formatted_word = ''.join([matched_char[char] for char in word])

    if formatted_word == S:
        count += 1

print(count)

0개의 댓글