Skip to content

Instantly share code, notes, and snippets.

@fullmated
Created May 1, 2011 09:34
Show Gist options
  • Save fullmated/950372 to your computer and use it in GitHub Desktop.
Save fullmated/950372 to your computer and use it in GitHub Desktop.
Aizu Online Judge No.0522 "JOI and IOI"
#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