Longest Word in Sentence Problem

Longest Word in Sentence Problem — ExecCode School DSA Practice

Solve the Longest Word in Sentence problem on ExecCode. Free online school DSA practice in Strings - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Given a sentence, find the longest word. Your task is to solve Longest Word in Sentence. If multiple words have the same maximum length, return the first one encountered.

Examples

Input hello world coding; Output coding. Input the quick brown fox jumps; Output quick

Constraints

1 <= len(S) <= 10^4

Practice Longest Word in Sentence free on ExecCode. Browse DSA problems, topic map, and placement guides.