Follows 494.c (Total 20 lines):

/* @JUDGE_ID:4461XX 494 C */
/* A */
#include <stdio.h>
#include <string.h>

void main(void)
{
	char a[10000];
	while( gets(a)!=NULL )
	{
		int i , j , words;
		words=0 ;
		for ( i=0 ; i<strlen(a)-1 ; i++ )
		{
			if ( ( ( a[i]>=65 && a[i]<=90 ) || ( a[i]>=97 && a[i]<=122 ) ) && ( a[i+1]<65 || ( a[i+1]>90 && a[i+1]<97 ) || a[i+1]>122 ) ) words++ ;
		}
		if ( ( a[strlen(a)-1]>=65 && a[strlen(a)-1]<=88 ) || ( a[strlen(a)-1]>=97 && a[strlen(a)-1]<=120 )) words++ ;
		printf( "%d\n" , words ) ;
	}
}

Back to statistics
Ya-Lin Huang (C)
huangyl@gmail.com