944. Find the Largest Word in a String
Given a string s consisting of multiple words separated by single spaces, return the largest word (i.e., the word with the maximum number of characters).
If multiple words have the same maximum length, return the first such word.
Example 1:
Input: s = "Google Doc"
Output: "Google"
Explanation:
'Google' has more characters than 'Doc'.
Example 2:
Input: s = "Microsoft Teams"
Output: "Microsoft"
Explanation:
'Microsoft' has more characters than 'Teams'.
Now Your Turn!
Pick the correct output for the given inputInput: s = "AI ML DL NN"
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= s.length <= 105
- s contains only uppercase and lowercase letters and spaces.
- Words are separated by a single space, and there are no leading or trailing spaces.