UVA Solution 494 Kindergarten Counting Game
Solution in C:
#include<stdio.h>
#include<string.h>
int main()
{
int words=0,i,len,flag=0;
char str[1000];
while(gets(str))
{
len=strlen(str);
flag=0;
for(i=0; i<len; i++)
{
if((str[i]>='A'&&str[i]<='Z')||(str[i]>='a'&&str[i]<='z'))
{
if((str[i+1]<'A'||str[i+1]>'Z')&&(str[i+1]<'a'||str[i+1]>'z'))
{
words++;
}
}
}
printf("%d\n",words);
words=0;
}
}
No comments