参考代码:
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语言程序设计教程(第三版)课后习题8.9 (C语言代码) 用函数传参的方法浏览:4101 |
求组合数 (C语言代码)浏览:1176 |
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:325 |
Hello, world! (C语言代码)浏览:852 |
图形输出 (C语言代码)浏览:960 |
敲七 (C++代码)浏览:1065 |
众数问题 (C语言代码)浏览:682 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:475 |
C语言程序设计教程(第三版)课后习题8.9 (C语言代码)浏览:515 |
A+B for Input-Output Practice (II) (C语言代码)浏览:605 |