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

Create solution.py