My LeetCode grinding. Trying to do a problem a day.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

problem.txt 381B

12345678910
  1. Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word (last word means the last appearing word if we loop from left to right) in the string.
  2. If the last word does not exist, return 0.
  3. Note: A word is defined as a maximal substring consisting of non-space characters only.
  4. Example:
  5. Input: "Hello World"
  6. Output: 5