CT28611

The Starlit Longest Word

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Caravans arrive at the moonlit lagoon of Selene with crates of charms, and Freya the scribe must account for every last one. Task: Read a line of space-separated words and print the longest word. If several share the maximum length, print the first. Input format: One line with words separated by single spaces. Output format: Print the longest word. Constraints: 1 <= |s| <= 1502; s contains lowercase English letters.

Example 1:

Input: s kw rigbwfcx
Output: rigbwfcx

Example 2:

Input: j jybv cwpcvqgnyjgl fehujnlfkhi oepgdj z c fpjl knpzvo swsqcqkyp bkxqtlbcirgu vqqpivhfvmx
Output: cwpcvqgnyjgl

Example 3:

Input: hxtbpdf pmzp eugdrvjl hmwsuudev ipx mfarvttmhqr dvbu mhmu
Output: mfarvttmhqr

Constraints:

1 <= |s| <= 1502; s contains lowercase English letters.

Loading...
Test Cases:No test cases
No test cases available.
The Starlit Longest Word - EASY Coding Problem | CodeTikki