Answer:
The solution code is written in Java
Explanation:
Firstly, create a Scanner object to read the user input text using nextLine method (Line 1-3).
Next, we can use the string split method and use single space " " as the separator to convert the input text to an array of individual word (Line 5).
We can simply use println to display the number of words in the array by using the length property of the array (Line 7). The word count is equal to the array length.