def count_IOI_KOI(s):
count_IOI = 0
count_KOI = 0
for i in range(len(s) - 2):
if s[i:i+3] == "IOI":
count_IOI += 1
elif s[i:i+3] == "KOI":
count_KOI += 1
return count_KOI, count_IOI
s = input().strip()
koi_count, ioi_count = count_IOI_KOI(s)
print(koi_count)
print(ioi_count)
정답
'정올 > beginner' 카테고리의 다른 글
정올 1071 수학1 - 약수와 배수 (0) | 2025.01.02 |
---|---|
정올 1430 수학1 - 숫자의 개수 (0) | 2024.12.30 |
정올 1338 도형만들기1 - 문자삼각형1 (1) | 2024.12.28 |
정올 1307 도형만들기1 - 문자사각형1 (0) | 2024.12.28 |
정올 5934 도형만들기2 - 별삼각형2 (0) | 2024.12.26 |