朱色虫居
Pages
Home
Featured Posts
2006/09/16
494-Kindergarten Counting Game
/*
"Kindergarten Counting Game"
Level:2.0
Date:2006/9/15
技巧:使用ctype.h
*/
#include
#include
int main(void){
int word;
int i = 0;
char s[200]={0}; //s[100] Wrong Answer
while(gets(s)){
word = 0;
for(i=0; s[i]!='\0'; i++){
if(isalpha(s[i]) && !isalpha(s[i+1])) //main idea
++word;
}
printf("%d\n",word);
}
return 0;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment