How many words in a sentence
Problem
Enter a character string from the keyboard and determine how many words it contains. A word is a sequence of non-whitespace characters separated by spaces on both sides (or standing at the end of a line). Words can be separated by multiple spaces. There can also be spaces at the beginning and end of the line.
Input: The first line is a sentence.
Output: you need to print one number - the number of words in the sentence.
Examples
# |
Input |
Output |
1 |
Vasja poshel guljat |
3 |