Return the number of characters in the final word of s. A word is a maximal run of non-space characters. Ignore trailing spaces and return 0 when no word exists.
Input / output
s: stringExamples
"Hello World" returns 5." fly me to the moon " returns 4.Constraints
0 <= s.length <= 100,000Follow-up Can you solve it with one reverse scan and no substring allocation?