题解 | #字符串最后一个单词的长度#
字符串最后一个单词的长度
http://www.nowcoder.com/practice/8c949ea5f36f422594b306a2300315da
字符串分割,暴力解答
import java.util.Scanner;
public class Main{public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String a=sc.nextLine();
String[] word = a.split(" ");
int wordlast=word[word.length-1].length();
System.out.println(wordlast);
}
}