Python 3
class Solution: def lengthOfLastWord(self, s: str) -> int: arr = str.split(s,' ') for i in range(len(arr)-1,-1,-1): if len(arr[i])>=1: return len(arr[i]) return 0
2022-10-22 08:39:18
class Solution: def lengthOfLastWord(self, s: str) -> int: arr = str.split(s,' ') for i in range(len(arr)-1,-1,-1): if len(arr[i])>=1: return len(arr[i]) return 0