8. Length of Last Word
Given a string s, return the length of its last word.
範例 1:
輸入: s = "Hello World" 輸出: 5
範例 2:
輸入: s = " fly me to the moon " 輸出: 4
限制條件:
1 <= s.length <= 10^4
Given a string s, return the length of its last word.
輸入: s = "Hello World" 輸出: 5
輸入: s = " fly me to the moon " 輸出: 4
1 <= s.length <= 10^4