Count the words in a given sentence, handling extra spaces and empty input.
Constraints
Example
>>> count_words("Hello world")
2
>>> count_words(" This is a test. ")
4
>>> count_words("")
0
>>> count_words(" ")
0
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints