(UVA)494-字串
#include<stdio.h>
int main() {
 char a[2000];
 while (gets(a)) {
  int i, temp = 0, count = 0;
  for (i = 0; a[i]; i++) {
   if (isalpha(a[i]))
    temp = 1;
   else {
    count += temp;
    temp = 0;
   }
  }
  count=count+temp;
 
  printf("%d\n", count);
 }
 return 0;
}  
 
留言
張貼留言