-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.java
More file actions
34 lines (29 loc) · 802 Bytes
/
test.java
File metadata and controls
34 lines (29 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.util.Scanner;
public class test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
char[][] arr = new char[5][15]; //5행 15열
for(int row=0;row<arr.length;row++) { //5
String str = sc.nextLine(); //단어 길이 입력
for(int col=0;col<str.length();col++) { //단어 길이만큼
arr[row][col] = str.charAt(col);
}
}
/* 출력
for(int row=0;row<5;row++) {
for(int col=0;col<15;col++) {
System.out.print(arr[row][col] + " ");
}
System.out.println();
}
*/
for(int row=0;row<15;row++) {
for(int col=0;col<5;col++) {
if(arr[col][row] == '\0') { //char에서 빈 문자 생성 \0 -> 유니코드
continue; //공백이면 넘어가기
}
System.out.print(arr[col][row]+"");
}
}
}
}