class Solution(object):
def lengthOfLastWord(self, s):
"""
:type s: str
:rtype: int
"""
ret=0
lastch = len(s)-1
for _ in xrange(len(s)):
if (s[lastch]==' '):
lastch-=1
for ind in xrange(lastch+1):
if (s[lastch-ind]==' '):
return ind
return lastch+1