Write a program which counts the number of words in text the user enters. Assume that a word is any characters separated by blanks. This isn't a very good definition, but we'll use it for this program.
Don't be fooled by multiple blanks. "test this" is two words, and so is "test this". Only count blanks if the last character you saw was not a blank, or you were at the beginning.
Because of our definition of "word" is any characters separated from others by a blank, "123" is a word, as well as "-".
Trim. First you should use
trim() to get rid
of blanks on the beginning and end.
Loop. Loop across the string one position at a time.