分2种情况
class Solution(object): def lengthOfLastWord(self, s): """ :type s: str :rtype: int """ t = ' ' if t not in s: return len(s) return len(s.strip().split(t)[-1].strip())