#C1303. Count the Number of Words
Count the Number of Words
Count the Number of Words
Given a string containing lowercase English letters and spaces, count and output the number of words in the string. A word is defined as any sequence of non-space characters. The string may have leading, trailing, or multiple spaces between words. Your task is to handle all these edge cases and correctly count the words.
Formally, if the input string is denoted by \( s \), then the number of words is defined as the number of substrings that satisfy the following condition: \[ \text{word} = \{ c \in s : c \neq ' ' \} \] No additional characters will appear in the string.
inputFormat
The input consists of a single string read from standard input (stdin). The string may span one or multiple lines and contains only lowercase letters and spaces.
outputFormat
Output a single integer to standard output (stdout), which is the count of words in the given string.
## samplehello
1