코딩 테스트/백준
[백준 2941]크로아티아 알파벳
ㅡㅡㅡㅡㄷ
2022. 8. 18. 22:38
https://www.acmicpc.net/problem/2941
2941번: 크로아티아 알파벳
예전에는 운영체제에서 크로아티아 알파벳을 입력할 수가 없었다. 따라서, 다음과 같이 크로아티아 알파벳을 변경해서 입력했다. 크로아티아 알파벳 변경 č c= ć c- dž dz= đ d- lj lj nj nj š s= ž z=
www.acmicpc.net
import sys
words=['c=','c-','dz=','d-','lj','nj','s=','z=']
input = sys.stdin.readline
string = input()
# print(string)
i=0
for word in words:
i+=string.count(word)
string=string.replace(word,'*') #치환 값을 빈칸('')으로 하면 nljj 중 lj가 치환되어 nj가 되고 테스트 실패 함.
# print(word,string)
string=string.replace('*','')
# print(string.strip())
print(i+len(string.strip()))