#K82497. Longest Words Extraction

    ID: 35988 Type: Default 1000ms 256MiB

Longest Words Extraction

Longest Words Extraction

You are given a string containing a sentence with words separated by spaces. Your task is to extract the longest word or words from the string. In case there are multiple words with the same maximum length, output all of them in the order they appear in the input. When processing the input, ignore any punctuation and consider words in a case-insensitive manner (i.e., treat uppercase and lowercase letters as equal).

For example, given the input:

The quick brown fox jumps over the lazy dogs!

The words with maximum length are: quick, brown, and jumps (all having 5 letters each).

inputFormat

A single line string is provided via standard input (stdin), representing a sentence. The input may contain punctuation.

outputFormat

Output the longest word or words separated by a single space on one line via standard output (stdout). If there is no word, output an empty line.## sample

The quick brown fox.
quick brown