Description
A sentence is a list of words separated by a single space. Given an array of sentences, return the maximum number of words that appear in a single sentence.
Examples
Input:
sentences = ["alice and bob love leetcode","i think so too","this is great thanks very much"]Output:
6Explanation:
Last sentence has 6 words.
Input:
hello worldprogramming is fun and challengingcodeOutput:
5Explanation:
The first sentence has 2 words, the second sentence has 5 words, and the third sentence has 1 word. The maximum is 5 words.
Input:
welcome to the coding interviewgood luckyou can do it well todayOutput:
6Explanation:
The first sentence has 5 words, the second sentence has 2 words, and the third sentence has 6 words. The maximum is 6 words.
Constraints
- •
1 ≤ sentences.length ≤ 100