Please solve the programming task below using a self-contained code snippet in a markdown code block.

Given a string s consisting of words and spaces, return the length of the last word in the string.
A word is a maximal substring consisting of non-space characters only.
 
Please complete the following python code precisely:
```python
class Solution:
    def lengthOfLastWord(self, s: str) -> int:
```