FunctionRacerProblemsRace

Longest Word in a Sentence

BeginnerStringsPython, JavaScript, TypeScript, Java, C++

Words in sentence are separated by single spaces. Return the longest word. If several words share the longest length, return the first of them.

Example 1

sentence "I love coding in python"
returns "coding"

python has 6 letters.

Example 2

sentence "one two six"
returns "one"

All have 3 letters, so the first.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Strings problems