The string s contains words that are separated by spaces. Find how long the last word is.
A word is a run of characters that are not spaces.
Examples
Example 1:
Input: s = "good morning India"
Output: 5
Explanation: The last word is "India", which has length 5.
Example 2:
Input: s = " hello "
Output: 5
Explanation: Spaces at the start or the end are not part of a word. The last word is "hello", length 5.
Example 3:
Input: s = "x"
Output: 1
Explanation: The only word is "x", length 1.