알고리즘
[백준 알고리즘] 2941번 크로아티아 알파벳. 파이썬(python)
삶은겨란
2022. 5. 15. 22:23
replace는 문자열을 변경하는 함수
변수.replace(old, new,[count])
old->new로 변경. count는 변경 횟수.(기본값은 -1, 전체)
str=input()
alphs=['c=', 'c-', 'dz=', 'd-', 'lj', 'nj', 's=', 'z=']
for alph in alphs:
str=str.replace(alph, '1') # 다른 글자에 영향을 주지 않는 한 글자 문자로 바꾼다
print(len(str))