2023-07-08 15:25:39 +0000 UTC

Length of Last Word

Code

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