#C12355. Longest Word Length
Longest Word Length
Longest Word Length
Given a string containing only alphabetic characters and spaces, your task is to determine the length of the longest word in the string.
A word is defined as a maximal substring consisting only of letters. For example, in the string "A quick brown fox", the longest word is "quick" which has 5 letters. The solution should be implemented such that it reads input from stdin
and sends the result to stdout
.
You can use the following mathematical relation to express the problem in \( \LaTeX \):
\( \max_{w \in W} |w| \)
where \( W \) is the set of all words extracted from the input string.
inputFormat
The input consists of a single line containing a non-empty string formed by alphabetic characters and spaces.
outputFormat
Output a single integer: the length of the longest word in the input string.
## samplealphabet
8
</p>