KINDJ - Kindergarten Counting Game

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

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

hide comments
2016-04-09 15:29:18 kamran siddique
1st Go :)
2014-01-10 21:02:43 Satyaki Upadhyay
@Dheeraj Out of the string MEEP!, the substring MEEP is a word. Separators between words can be any non-alphabetic character not just space.
2013-06-01 11:39:18 codedhrj
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 ?
2012-06-11 00:55:53 Ashhar Jawaid


Last edit: 2012-06-11 15:26:02
2012-04-14 08:39:16 noju
can anyone explain last test case how it is 9?? must it not be 10???
2012-03-22 11:07:19 last outlaw
i got wrong answer, can nyone give me some tricky test cases....
2012-03-11 13:33:16 Aradhya
easy l :-)
2012-02-21 19:52:58 Garima Sachan
String str = in.readLine();
if(str==null)break;
2012-02-21 15:47:28 Jay
how to detect end of file in java;;i got the logic;;;not able to take the input..
2011-11-30 03:34:10 Bahrul Halimi
i got TLE....give me some way....

Last edit: 2011-11-30 17:34:00
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.