8. Length of Last Word
Given a string s, return the length of its last word.
Example 1:
Input: s = "Hello World" Output: 5
Example 2:
Input: s = " fly me to the moon " Output: 4
Constraints:
1 <= s.length <= 10^4
Given a string s, return the length of its last word.
Input: s = "Hello World" Output: 5
Input: s = " fly me to the moon " Output: 4
1 <= s.length <= 10^4