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

봉글렛·2023년 1월 9일

백준

목록 보기
30/55

문제 링크 https://www.acmicpc.net/problem/2941

replace 할때 단어를 지우면 새로운 글자가 완성 될지도 모른다.

cro_a = ['c=', 'c-', 'dz=', 'd-', 'lj', 'nj', 's=', 'z=']
words = input()
result = 0
for alp in cro_a:
    if words.count(alp) > 0:
        result += words.count(alp)
        words = words.replace(alp, ' ')
words = words.replace(' ', '')
result += len(words)
print(result)
profile
어쩌다 개발자 (할 수 있을 때까지!!!!)

0개의 댓글