58. Length of Last Word

class Solution(object):
    def lengthOfLastWord(self, s):
        """
        :type s: str
        :rtype: int
        """
        res=s.split()
        if len(res)!=0:
            return len(res[-1])
        else:
            return 0

  

posted @ 2017-12-23 19:00  PirateLHX  阅读(100)  评论(0编辑  收藏  举报