Go back to Challenges list
Leave No Word Uncounted
In this challenge you need to analyse a string and return the number of words present in that string. Seems pretty easy right? It is, but there are some rules:
- A word is defined by one or more alphanumeric characters (a-zA-Z0-9)
- Every other character acts like a word divisor (like a space)
- Single letters and numbers will count as words too!!!
- A word is defined by one or more alphanumeric characters (a-zA-Z0-9)
- Every other character acts like a word divisor (like a space)
- Single letters and numbers will count as words too!!!
Input Format
Each test case contains a string to be analysed.Output Format
The output should be an integer with the number of wordsSample Input
Praesent sapien.massa, convallis a pellentesque-nec, egestas non nisi.
Sample Output
10
Memory Limit
512M