Files

9 lines
201 B
Python

class Solution(object):
def lengthOfLastWord(self, s):
"""
:type s: str
:rtype: int
"""
s = s.strip()
words = s.split()
return len(words[-1])