#C10748. Longest Word Finder

    ID: 39987 Type: Default 1000ms 256MiB

Longest Word Finder

Longest Word Finder

Given a string containing words separated by whitespace, your task is to find the longest word in the string. All punctuation and non-alphabetic characters should be ignored. If there are multiple words of the same maximum length, output the one that appears first in the sentence.

If the string does not contain any alphabetical characters, output an empty string.

In mathematical terms, if S is the input sentence, after removing all non-letter characters, let W = {w₁, w₂, ..., wₙ} be the set of words such that:

\( w^* = \arg\max_{w \in W} |w| \)

inputFormat

The input consists of a single line containing the sentence. The sentence may include punctuation and other non-alphabetical characters.

outputFormat

Output the longest word from the input sentence after filtering out punctuation and non-alphabetic characters. If no valid word exists, output an empty string.

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