Ctrl K

Wordiest Message

Easy
A chat holds the messages messages. Each message is made of words of lowercase English letters separated by exactly one space, with no spaces at the start or end. Return the number of words in the message that has the most words.
Example 1
messages=["see you at noon", "ok", "running late sorry"] → 4

The first message has four words, the second one, the third three. The maximum is 4.

Example 2
messages=["call me", "on my way", "got it"] → 3

The second message is the wordiest, with three words.

Constraints
  • 1 ≤ len(messages) ≤ 100
  • 1 ≤ len(messages[i]) ≤ 100
  • messages[i] consists of lowercase English letters and spaces
  • Words are separated by a single space, with no leading or trailing spaces
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsTwo Words, Closest Apart EasyOne-Row Typing EasyDinner for Two EasyPhrases with Synonyms EasyWord from a License Plate Easy
loading Python…
Input
messages=["see you at noon", "ok", "running late sorry"]
Expected
4

Run checks the first 3 tests in your browser. Submit checks all 77 tests on the server, hidden ones included.