제목 : https://leetcode-cn.com/problems/length-of-last-word/
대답:
public int lengthOfLastWord (String s) {
s = s.trim ();
int index = s.lastIndexOf ( "");
if (인덱스 <0) {
return s.length ();
}그밖에{
return s.length ()-index-1;
}
}
제목 : https://leetcode-cn.com/problems/length-of-last-word/
대답:
public int lengthOfLastWord (String s) {
s = s.trim ();
int index = s.lastIndexOf ( "");
if (인덱스 <0) {
return s.length ();
}그밖에{
return s.length ()-index-1;
}
}