Search across blog, articles, projects, courses, and community posts
Read one line of text and print how many words it contains. Words are separated by one or more spaces, and the line may start or end with spaces.
Input: one line of text.
Output: the number of words.
The line has 1 to 1000 characters (letters and spaces) and contains at least one word.
the quick brown fox
4
hello world
2