Word count X86598


Statement
 

pdf   zip

Write an integer function @word_count(s)@ that returns the number of words in string ss. We assume all characters of ss are letters and spaces. Warning: do not use the split string method.

Sample session

Sample session
>>> word_count('Qui invenit amicum invenit thesaurum')
5
>>> word_count('alea iacta          est')
3
>>> word_count('KingKong')
1
Information
Author
ProAl
Language
English
Official solutions
Python
User solutions
Python