All tasks
Mediumstrings

Longest Word

Time limit 2 s · Memory 64 MBAcceptance: —Solved by: 0

Statement

One line contains words of lowercase Latin letters separated by spaces. Print the longest word. If several words tie, print the first of them.

Examples

Example 1
Input
the quick brown fox
Output
quick
Example 2
Input
a bb cc
Output
bb

Constraints

  • Line length is between 1 and 10^5
  • There is at least one word
Solve this task to unlock the editorial.

AI tutor

Stuck? Get a nudge — the tutor explains the idea, it never hands you the solution.