mtsuyugu #5524(2008/01/28 14:18 GMT) [ C ] Rating1/1=1.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#include <stdlib.h> #include <stdio.h> int main( int argc, char *argv[] ){ char *p; int n = 0, j = 0, i = 0; if( argc < 2 ) return EXIT_FAILURE; for( p = argv[1]; *p; p++ ){ if( *p == 'J' || *p == 'I' ){ n = *p; } else if( n && *p == 'O' && *(p+1) == 'I' ){ if( n == 'J' ) j++; if( n == 'I' ) i++; n = 'I'; p++; } else{ n = 0; } } printf("%d\n%d\n",j,i); return EXIT_SUCCESS; }
Rating1/1=1.00-0+
[ reply ]
mtsuyugu
#5524()
[
C
]
Rating1/1=1.00
Rating1/1=1.00-0+
[ reply ]