解题思路:
注意事项:
参考代码:
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { //*****不能出现两个输入流******* BufferedReader bufr = new BufferedReader(new InputStreamReader(System.in)); String n = bufr.readLine(); int N = Integer.parseInt(n); String str = null; while ((str = bufr.readLine()) != null) { if (N-- > 0) { System.out.println(str + '\n'); } else { String s = str.replaceAll("\\s+", " "); String s1 = s.trim(); String [] str1 = s1.split(" "); for(int j=0;j<str1.length;j++) { System.out.println(str1[j]+'\n'); } } } } }
0.0分
2 人评分