Loading...
Loading...
Loading...
A message is typed on one line. Words are separated by one or more spaces, and the line may start or end with spaces. Print how many words it has. The starter holds a program with a bug. Find it and fix it.
Example 1
Input
hello world
Output
2
Two words.
Example 2
Input
two words
Output
2
Extra spaces do not make extra words.
Try the problem first. Open one hint at a time.
Split the text so that runs of spaces count as one separator.
split() with no argument does that.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor