Length of Last Word
Question
Example:
Answer
solution:this is done myself
class Solution(object):
def lengthOfLastWord(self, s):
"""
:type s: str
:rtype: int
"""
a = re.findall("[A-Za-z]+",s)
if a:
return len(a[-1])
else:
return 0Knowledge:
Last updated