#include <stdio.h> #include <ctype.h> int main() { char temp; int counter = 0; int isWord = 0; while((temp = getchar()) != EOF){ if(temp == '\n'){ printf("%d\n", counter); counter = 0; isWord = 0; }else{ if((temp >= 65 && temp <= 90)||(temp >= 97 && temp <= 122)){ if(isWord == 0){ isWord = 1; counter++; } }else{ if(isWord == 1){ isWord = 0; } } } } return 0; }
No comments:
Post a Comment