diff --git a/58-length-of-last-word/58-length-of-last-word.py b/58-length-of-last-word/58-length-of-last-word.py new file mode 100644 index 0000000..d45f27c --- /dev/null +++ b/58-length-of-last-word/58-length-of-last-word.py @@ -0,0 +1,9 @@ +class Solution(object): + def lengthOfLastWord(self, s): + """ + :type s: str + :rtype: int + """ + s = s.strip() + words = s.split() + return len(words[-1]) \ No newline at end of file