4.14
无话可说
public class Solution {
/**
* @param s A string
* @return the length of last word
*/
public int lengthOfLastWord(String s) {
if(s == null){
return 0;
}
String[] tmp = s.split(" ");
int x = tmp.length;
return tmp[x-1].length();// Write your code here
}
}
转载请注明原文地址: https://ju.6miu.com/read-674743.html