class Solution: def lengthOfLastWord(self, s: str) -> int: tokens = s.split() if len(tokens) == 0: return 0 return len(tokens[len(tokens)-1]) def main(): s = Solution() print(s.lengthOfLastWord("Hello World")) if __name__ == '__main__': main()