IT보안관의 공부 클라우드
[백준 2941]크로아티아 알파벳 본문
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()))
'코딩 테스트 > 백준' 카테고리의 다른 글
[백준 1193]분수찾기 (0) | 2022.08.22 |
---|---|
[백준 16194]카드 구매하기2 (0) | 2022.07.09 |
[백준 9095]1, 2, 3 더하기 (0) | 2022.07.09 |
[백준 1874]스택 수열 (0) | 2022.07.07 |
[백준 12865]평범한 배낭 (0) | 2022.07.07 |
Comments