Skip to content

Commit 1a44eea

Browse files
authored
58.LengthOfLastWord
1 parent ca58868 commit 1a44eea

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

LengthOfLastWord.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Solution {
2+
public int lengthOfLastWord(String s) {
3+
String temp = s.trim();
4+
String[] arr = temp.split(" ");
5+
String last = arr[arr.length-1];
6+
return last.length();
7+
}
8+
}

0 commit comments

Comments
 (0)