Kindergarten counting game |
Everybody sit down in a circle. OK. Listen to me carefully.
''Woooooo, you scwewy wabbit! ''
Now, cocould someone tell me how many words I just said?
Input and Output
Input to your program will consist of a series of lines, each line containing multiple words (at least one ). A ''word'' is defined as a consecutive sequence of letters (upper and/or lower case ).
Your program shocould output a word count for each line of input. Each word count shocould be printed on a separate line.
Sample Input
Meep! I tot I taw a putty tat. I did! I did! I did taw a putty tat. shsssssssssh... I am hunting wabbits. Heh heh...
Sample output
27109
# Include <iostream> # include <cstdio> # include <string> # include <cstring> # include <map> # include <queue> # include <stack> # include <algorithm> # include <cmath> # include <cctype> // # define lllusing namespace STD; int main () {# ifdef lll freopen ("C: \ Documents and Settings \ K70 \ Desktop \ cin.txt", "r", stdin ); freopen ("C :\\ Documents and Settings \ K70 \ Desktop \ out.txt", "W", stdout); # endif char C; bool FF = true; int ans = 0; while (C = G Etchar ())! = EOF) {If (isalpha (c) {If (FF) {ans ++; FF = false ;}} else if (C = '\ n ') {printf ("% d \ n", ANS); ans = 0; FF = true;} else {FF = true ;}} return 0 ;}
Kindergarten counting game |
Everybody sit down in a circle. OK. Listen to me carefully.
''Woooooo, you scwewy wabbit! ''
Now, cocould someone tell me how many words I just said?
Input and Output
Input to your program will consist of a series of lines, each line containing multiple words (at least one ). A ''word'' is defined as a consecutive sequence of letters (upper and/or lower case ).
Your program shocould output a word count for each line of input. Each word count shocould be printed on a separate line.
Sample Input
Meep! I tot I taw a putty tat. I did! I did! I did taw a putty tat. shsssssssssh... I am hunting wabbits. Heh heh...
Sample output
27109