#K5186. Longest Word Finder
Longest Word Finder
Longest Word Finder
Given a string, you are to extract the longest word from it. A word is defined as a sequence of letters (A–Z, a–z) that may contain at most one apostrophe (') within it. If there are several words with the same length, return the first one encountered. Punctuation and other non-letter characters act as delimiters. The problem requires reading from the standard input and printing the result to the standard output.
Note: If the input is an empty string, output an empty line.
inputFormat
The input consists of a single line containing a sentence. The sentence may include letters, punctuation marks, spaces, and apostrophes.
outputFormat
Output a single line which is the longest word extracted from the sentence following the rules described. If no valid word exists, output an empty line.
## sampleHello world!
Hello
</p>