class Solution:
    def lengthOfLastWord(self, s: str) -> int:
        l = list(s.split(' '))
        while (l and l[len(l)-1] == ""):
            l.pop(len(l)-1) 
        if l:
            return len(l[len(l)-1])
        else:
            return 0
676c3d3026ef70d982cb8fe701cbd5ee6b9e2564
<mask token>

class Solution:
    <mask token>

class Solution:

    def lengthOfLastWord(self, s: str) ->int:
        l = list(s.split(' '))
        while l and l[len(l) - 1] == '':
            l.pop(len(l) - 1)
        if l:
            return len(l[len(l) - 1])
        else:
            return 0

class Solution:
    def lengthOfLastWord(self, s: str) -> int:
        l = list(s.split(' '))
        while (l and l[len(l)-1] == ""):
            l.pop(len(l)-1) 
        if l:
            return len(l[len(l)-1])
        else:
            return 0