Question bank › Strings
Dsa Strings Easy

Maximum Word Length in Sentence

Given a sentence (a string of words separated by spaces), find the length of the longest word. Words are defined as sequences of non-space characters. Input: The input is a single line containing the sentence s (1 ≤ |s| ≤ 200). Output: Print the length of the longest word in the sentence. Example: Input: The quick brown fox Output: 5

Key concepts

stringssentenceswords

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.