Problems > The Longest Word

The Longest Word

Difficulty: 800 2000 ms 128 MB

strings

Print the longest word of the line; on ties print the earliest one.

Input: one line with words separated by single spaces.

Output: the longest word (earliest on ties).

Constraints:

  • 1 to 200 words of lowercase letters

Sample Tests

Input 1
i love solving problems
Output 1
problems
Input 2
aa bb cc
Output 2
aa

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.