#C1063. Longest Word Finder

    ID: 39856 Type: Default 1000ms 256MiB

Longest Word Finder

Longest Word Finder

You are given a string. Your task is to find the longest word in the string. In case there are multiple words with the same maximum length, you should return the last occurrence among them.

For example, given the input string "the quick brown fox jumps over the lazy dog", the longest word is "jumps" because although "quick" and "brown" also have 5 letters, "jumps" appears later in the string.

The words in the string are separated by whitespace. If the input string is empty or contains no words, output an empty string.

Note: The length calculation for each word is simply the number of characters it contains.

inputFormat

The input consists of a single line containing the string to be processed. The string may contain spaces and punctuation.

outputFormat

Output the longest word from the input string. If multiple words share the longest length, output the one that appears last.

## sample
the quick brown fox jumps over the lazy dog
jumps