Given a string s containing words and spaces, return the length of the last word.
A word is defined as the longest sequence of non-space characters.
Input: s = "Wscube tech"
Output: 4
Explanation:
The last word is "tech", which has length 4.
Input: s = " upskilling bharat"
Output: 6
Explanation:
The last word is "bharat", which has length 6.
Input: s = " learn to code "
Output: 4
Explanation:
The last word is "code", which has length 4.
Accepted:
Submission: