class Solution:

# @param {string} s

# @return {integer}

```
def lengthOfLastWord(self, s):
counter = 0
index = len(s) - 1
while index >= 0 and s[index] == ' ':
index -= 1
while index >= 0 and s[index] != ' ':
counter += 1
index -= 1
return counter
```