Given a sentence, find out the no. of words in the sentence. You can assume that there are no whitespaces before the first word and after the last word in the sentence.
This problem requires you to read line-by-line instead of word-by-word which is the default behavior in most languages.
Google "read line in C++". Replace C++ with the language that you are using.
A single sentence
The no. of words in the sentence
The quick brown fox jumped over the lazy dog.
9
0 < length of sentence <= 100000