```
class Solution(object):
def lengthOfLastWord(self, s):
"""
:type s: str
:rtype: int
"""
res = 0
a = s.split(" ")
for i in range(len(a) - 1,-1,-1):
if a[i] != "":
res = len(a[i])
return res
return res
```