[백준] 2941 크로아티아 알파벳

김은서·2021년 12월 8일
0

백준

목록 보기
38/48

Python Code

T = int(input())
for tc in range(1, T+1):
    alphabet = ['c=', 'c-', 'dz=', 'd-', 'lj', 'nj', 's=', 'z=']
    word = input()
    cnt = 0
    for i in range(len(alphabet)):
        if alphabet[i] in word:
            cnt += word.count(alphabet[i])
            word = word.replace(alphabet[i], ",")
    word = word.replace(",", "")
    cnt += len(word)
    print(cnt)
profile
Gracelog

0개의 댓글