[Python] BOJ 5525번. IOIOI 작성일 2020-06-02 | In Algorithm | 5525번. IOIOI 문제 링크 https://www.acmicpc.net/problem/5525 풀이 코드 12345678910111213141516171819202122232425262728# 5525번. IOIOI import sys input = sys.stdin.readline n = int(input()) m = int(input()) s = input().rstrip() i = -1 cntO = 0 ans = 0 try: while i < m-2: i += 1 if s[i] == 'I': cntO = 0 while s[i+1] == 'O' and s[i+2] == 'I': cntO += 1 i += 2 if cntO == n: cntO -= 1 ans += 1 if i > m-2: break except: pass print(ans) 비고