def lengthOfLastWord(self, s):
:type s: str
return list(map(lambda i: len(i),s.strip().split(" ")))[-1]
return len(s.strip().split(" ")[-1]) would be sufficient.
return len(s.strip().split(" ")[-1])
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.