easy
strings
Given a string s consisting of only printable ASCII characters, write a function length_of_last_word(s: str) -> int that returns the length of the last word in the string.
A word is defined as a maximal substring consisting of non-space characters only.
If there are no words in the string, return 0.
Note that the input string may contain leading or trailing spaces, and the words are separated by one or more spaces.
Examples
Example 1
Input: s = "Hello World"
Output: 5
Example 2
Input: s = " "
Output: 0
Example 3
Input: s = "a "
Output: 1
Running will execute all 3 cases.