参考代码:
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语言程序设计教程(第三版)课后习题11.5 (C语言代码)浏览:907 |
P1001 (C语言代码)浏览:803 |
大神老白 (C语言代码)浏览:647 |
C语言程序设计教程(第三版)课后习题6.11 (C语言代码)浏览:549 |
C语言程序设计教程(第三版)课后习题5.8 (C语言代码)浏览:672 |
1126题解浏览:599 |
C二级辅导-分段函数 (C语言代码)浏览:601 |
C语言程序设计教程(第三版)课后习题6.7 (C语言代码)浏览:687 |
上车人数 (C语言代码)浏览:714 |
C语言程序设计教程(第三版)课后习题6.5 (C语言代码)浏览:497 |