#C13738. Longest Word Length

    ID: 43309 Type: Default 1000ms 256MiB

Longest Word Length

Longest Word Length

You are given a string that consists of multiple words which may be separated by spaces and punctuations. Your task is to calculate the length of the longest word in the string. Note that any punctuation character (such as ., ,, !, ?, ;, :, ", and ') is treated as a space. If the string is empty or does not contain any valid word, output 0.

Input Format: The input is read from stdin and consists of a single line containing the string.

Output Format: Output a single integer – the length of the longest word – to stdout.

Examples:

  • Input: "The quick brown fox jumped over the lazy dog." Output: 6
  • Input: "Wow! Such a, wonderful; day isn't it?" Output: 9

inputFormat

The input consists of a single line that contains a string s. The string may include letters, spaces, and punctuations.

outputFormat

The output should be a single integer representing the length of the longest word in the input string after treating all punctuation characters as spaces.

## sample
The quick brown fox jumped over the lazy dog.
6