"""
Given a string s consists of upper/lower-case alhabets and empty space
characters ' ', return the length of last word in the string.

If the last word does not exist, return 0.

Example:
    Input: "Hello World"
    Output: 5
"""

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

def test():
    s = "Hello World, my name is Hunter"
    sol = Solution()
    print(f"Length of last word for \'{s}\' is {sol.lengthOfLastWord(s)}")

test()

8a06feb18244f4b26a972a06b2fac32e0a82880b
<mask token>


class Solution:
    <mask token>


<mask token>

<mask token>


class Solution:

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


<mask token>

<mask token>


class Solution:

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


def test():
    s = 'Hello World, my name is Hunter'
    sol = Solution()
    print(f"Length of last word for '{s}' is {sol.lengthOfLastWord(s)}")


<mask token>

<mask token>


class Solution:

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


def test():
    s = 'Hello World, my name is Hunter'
    sol = Solution()
    print(f"Length of last word for '{s}' is {sol.lengthOfLastWord(s)}")


test()

"""
Given a string s consists of upper/lower-case alhabets and empty space
characters ' ', return the length of last word in the string.

If the last word does not exist, return 0.

Example:
    Input: "Hello World"
    Output: 5
"""

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

def test():
    s = "Hello World, my name is Hunter"
    sol = Solution()
    print(f"Length of last word for \'{s}\' is {sol.lengthOfLastWord(s)}")

test()
