参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); print(input()); } public static String[] input(){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); // 吸收空格 sc.nextLine(); String[] st = new String[n]; for (int i = 0; i < n; i++) { String str = sc.nextLine(); st[i] = str.replaceAll(" ",",");; } return st; } public static void print(String[] st){ for (int i = 0; i < st.length; i++) { System.out.println(st[i]); } } }
0.0分
2 人评分
C二级辅导-同因查找 (C语言代码)浏览:684 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:586 |
C语言程序设计教程(第三版)课后习题11.5 (C语言代码)浏览:1541 |
C语言程序设计教程(第三版)课后习题6.9 (C语言代码)浏览:1019 |
Wu-求圆的面积 (C++代码)浏览:1909 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:844 |
C语言程序设计教程(第三版)课后习题6.2 (C语言代码)浏览:694 |
C语言训练-自由落体问题 (C语言代码)浏览:629 |
C二级辅导-等差数列 (C语言代码)浏览:737 |
C二级辅导-统计字符 (C语言代码)浏览:486 |