题解 | #字符串最后一个单词的长度#
字符串最后一个单词的长度
https://www.nowcoder.com/practice/8c949ea5f36f422594b306a2300315da
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class HJ1 { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str; while((str = br.readLine()) != null) { String[] col = str.split(" "); System.out.println(col[col.length-1].length()); } } }