본문 바로가기
python-algorithm

[백준] 5586

by 무적김두칠 2021. 1. 9.

1
2
3
4
5
6
7
8
9
import sys
s=sys.stdin.readline()
cnt1=0
cnt2=0
for i in range(len(s)-2):
    if s[i]=='J' and s[i+1]=='O' and s[i+2]=='I': cnt1+=1
    elif s[i] == 'I' and s[i + 1== 'O' and s[i + 2== 'I': cnt2 += 1
print(cnt1)
print(cnt2)
cs
반응형

'python-algorithm' 카테고리의 다른 글

[백준] 5622  (0) 2021.01.09
[백준] 5597  (0) 2021.01.09
[백준] 5576  (0) 2021.01.09
[백준] 5524  (0) 2021.01.09
[백준] 5363  (0) 2021.01.09

댓글