Uvaoj494-kindergarten counting game

Source: Internet
Author: User



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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.