95. Longest Word in the Sentence

Acceptance — 0 accepted 0 submissions

Easy
Strings
No companies listed
During a spelling bee, the judge picks the longest word from a sentence.

Print the longest word. If several words share the greatest length, print the one that appears first.

Input Format
A single line of words separated by single spaces.

Output Format
Print the longest word.

Constraints
• 1 ≤ length ≤ 1000

Example 1

Input
I love eating masala dosa
Output
eating

Explanation eating and masala both have 6 letters. eating comes first.

Example 2

Input
Programming is fun
Output
Programming

Explanation Programming is clearly the longest.

Example 3

Input
hi
Output
hi

Explanation Only one word.

Acceptance —
Accepted 0
Submissions 0
Auto-save
Saved Ln 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
eating
No results yet
Run your code to test it against the sample cases.
Problem List