@@ -0,0 +1,542 @@
+package leetcode;%0A%0A/**%0A * https://oj.leetcode.com/problems/length-of-last-word/%0A */%0Apublic class Problem58 %7B%0A    public int lengthOfLastWord(String s) %7B%0A        int idx = s.length()-1;%0A        while (idx %3E= 0 && s.charAt(idx) == ' ') %7B%0A            idx--;%0A        %7D%0A        int lastWordLength = 0;%0A        for (int i = idx; i %3E= 0; i--) %7B%0A            if (s.charAt(i) == ' ') %7B%0A                idx = i;%0A                break;%0A            %7D else %7B%0A                lastWordLength++;%0A            %7D%0A        %7D%0A        return lastWordLength;%0A    %7D%0A%7D%0A

Solve problem 58