很好奇还有什么更快的算法

class Solution:
    def lengthOfLastWord(self, s: str) -> int:
        j = len(s)-1
        while j>=0 and s[j]==' ':
            j -= 1
        i = j
        while i>=0 and s[i]!=' ':
            i -= 1
        return j-i

58. Length of Last Word刷题笔记_python