#K14261. Longest Word Finder
Longest Word Finder
Longest Word Finder
Given a string of text, your task is to extract the longest word from it. A word is defined as a continuous sequence of alphabetical characters (i.e. matching the regular expression [A-Za-z]+
). Formally, you can say that a word \(w\) in a text \(t\) is a substring where every character \(c\) in \(w\) satisfies \(c \in \{a, b, \ldots, z, A, B, \ldots, Z\}\).
If two or more words share the maximum length, the first occurrence should be output.
inputFormat
The input consists of a single line containing a string \(S\) which may include letters, digits, punctuation marks, and spaces.
outputFormat
Output the longest word extracted from the input. In case of ties, output the first word with the maximum length.
## sampleThe quick brown fox.
quick