UVA 494(Kindergarten Counting Game)

这道题的标题中的幼儿园让人看得郁闷,计算单词的数目...

#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>

char ch[1000];

int main()
{
char a[100];
while( gets(ch) != NULL)
{
int len = strlen(ch);
int cnt = 0;
for(int i = 0; i <= len; i ++)
{
if( isalpha( ch[i] ) && !isalpha( ch[i+1] ) )
cnt ++;
}
printf("%d\n", cnt);
}
return 0;
}

 

你可能感兴趣的:(count)