Algorithm/Baekjoon

#백준 2941 크로아티아 알파벳, 파이썬

say! 2022. 6. 29. 16:33
728x90
#백준 2941 : 크로아티아 알파벳

text = input()

alph = ['c=', 'c-', 'dz=', 'd-', 'lj', 'nj', 's=', 'z=']

for i in alph:
    if i in text:

내 머리로는 풀이가 여기서 멈춰버렸다... 어떻게 풀어야할지...ㅎㅜㅜㅜ

 

#백준 2941 : 크로아티아 알파벳

text = input()

alph = ['c=', 'c-', 'dz=', 'd-', 'lj', 'nj', 's=', 'z=']

for i in alph:
    text = text.replace(i,"*")
print(len(text))

크로아티아 알파벳을 *로 바꿔서 하나의 문자로 보고 문자의 개수를 세면 되는거였다..