#C4837. Length of Last Word

    ID: 48419 Type: Default 1000ms 256MiB

Length of Last Word

Length of Last Word

You are given a string s consisting of English letters and space characters. Your task is to find the length of the last word in the string.

A word is defined as a maximal substring consisting of non-space characters only.

Mathematically, if we split s by spaces into an array of words W, then the answer is |W_last|, where W_last is the last element of W and |·| denotes the length of a word. In LaTeX, this can be represented as:

$$ \text{answer} = \left| W_{\text{last}} \right| $$

If there is no word in the given string (i.e. when the string is empty or contains only spaces), the answer should be 0.

inputFormat

The input is provided via stdin and consists of a single line containing the string s. The string may include spaces and can be empty.

Note: The input should be read from standard input.

outputFormat

Output a single integer representing the length of the last word in s to stdout.

## sample
Hello World
5