494 - Kindergarten Counting Game

#include<stdio.h>
#include<ctype.h>
char words[200];
int main()
{
 char *p;
 int next,count;
 while(fgets(words,200,stdin))
 {
  count=0;
  p=words;
  next=1;
  while(*p!='\0')
  {
   if(*p>='a'&&*p<='z'||*p>='A'&&*p<='Z')
   {
    if(next==1)
     count++;
    next=0;
    p++;
    continue;
   }
   else
   {
    next=1;
    p++;
   }
  }
  printf("%d\n",count);
 }
 return 0;
}

你可能感兴趣的:(count)