Skip to content

Commit b695b8c

Browse files
58. Length of Last Word (java)
1 parent 4eeab47 commit b695b8c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution {
2+
public int lengthOfLastWord(String s) {
3+
s = s.trim();
4+
return s.length()-s.lastIndexOf(" ")-1;
5+
}
6+
}

0 commit comments

Comments
 (0)