Created
May 1, 2011 09:34
-
-
Save fullmated/950372 to your computer and use it in GitHub Desktop.
Aizu Online Judge No.0522 "JOI and IOI"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <cstring> | |
int main(){ | |
char str[10001]; | |
while(1){ | |
int joi = 0, ioi = 0; | |
scanf("%s", str); | |
if(*str == 0)break; | |
for(int i = 0; i < 9999; i++){ | |
if(str[i+1] == 'O' && str[i+2] == 'I'){ | |
if(str[i] == 'J') joi++; | |
else if(str[i] == 'I') ioi++; | |
} | |
} | |
printf("%d\n%d\n", joi, ioi); | |
memset(str, '\0', 10001); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment