[문제]

[풀이]
croatia_alphabet = ['c=', 'c-', 'd-', 'lj', 'nj', 's=', 'z=']
words = input()
i = 0
result = 0
while i < len(words):
if i + 2 < len(words) and words[i : i + 3] == 'dz=':
result += 1
i += 3
continue
elif i + 1 < len(words) and words[i : i + 2] in croatia_alphabet:
result += 1
i += 2
continue
result += 1
i += 1
print(result)
- continue를 꼭 써서 중복 카운트 발생안하게~~ 잘하자!

[링크]
https://www.acmicpc.net/problem/2941
'CodingTest > Baekjoon' 카테고리의 다른 글
| [백준] 2018 수들의 합(python, 투포인터) (1) | 2025.08.10 |
|---|---|
| [백준] 10825 국영수(python, 정렬) (0) | 2025.08.08 |
| [백준] 10814 나이순 정렬(python, 정렬) (0) | 2025.08.08 |
| [백준] 11651 좌표 정렬하기2(python, 정렬) (0) | 2025.08.08 |
| [백준] 1316 그룹단어 체커(python, 구현) (0) | 2025.08.07 |
