text made of English letters and spaces. A word is a run of non-space characters that cannot be extended to the left or to the right.
Return the length of the last word in the string. Spaces may appear at the start, at the end, and several in a row.text="Good morning everyone" → 8
The last word is everyone, which has 8 letters.
text=" see you later " → 5
Trailing spaces do not count: the last word is later.
text="Hi" → 2
text consists of English letters and spacestext contains at least one wordtext="Good morning everyone"
8
Run checks the first 3 tests in your browser. Submit checks all 6 tests on the server, hidden ones included.