KINDJ - Kindergarten Counting Game

no tags 

Everybody sit down in a circle. Ok. Listen to me carefully.

``Woooooo, you scwewy wabbit!''

Now, could 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 should output a word count for each line of input. Each word count should be printed on a separate line.

 

Sample Input

Meep 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 Heh Heh ...

 

Sample Output

2
7
10
9

hide comments
kamran siddique: 2016-04-09 15:29:18

1st Go :)

Satyaki Upadhyay: 2014-01-10 21:02:43

@Dheeraj Out of the string MEEP!, the substring MEEP is a word. Separators between words can be any non-alphabetic character not just space.

codedhrj: 2013-06-01 11:39:18

A word'' is defined as a consecutive sequence of letters (upper and/or lower case).
Test CASE: Meep Meep!
why MEEP! is counted as a word ?

Ashhar Jawaid: 2012-06-11 00:55:53

Last edit: 2012-06-11 15:26:02
noju: 2012-04-14 08:39:16

can anyone explain last test case how it is 9?? must it not be 10???

last outlaw: 2012-03-22 11:07:19

i got wrong answer, can nyone give me some tricky test cases....

Aradhya: 2012-03-11 13:33:16

easy l :-)

Garima Sachan: 2012-02-21 19:52:58

String str = in.readLine();
if(str==null)break;

Jay: 2012-02-21 15:47:28

how to detect end of file in java;;i got the logic;;;not able to take the input..

Bahrul Halimi: 2011-11-30 03:34:10

i got TLE....give me some way....

Last edit: 2011-11-30 17:34:00

Added by:Andres Tellez
Date:2011-09-12
Time limit:0.600s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64