Count Words in a Sentence
Not Started

Implement the method, countWordsInASentence that takes a string as input and returns the number of words in the sentence. A word is defined as a sequence of non-space characters separated by one or more spaces.

Example 1

Input: "Camp Apex"
Output: 2
Explanation: The sentence contains 2 words


Example 2

Input: "Who Will Dethrown CleanCode_DirtyRoom?"
Output: 4
Explanation: There are 4 words.


Example 3

Input: " Ignore Leading And Trailing Whitespace "
Output: 5
Explanation: There are 5 words.


Constraints:

The input can contain up to 1000 words.
The input may contain leading and trailing spaces