Algorithm/백준
[알고리즘] 백준 10798 Java
rw-
2023. 3. 29. 21:06
728x90
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
char[][] arr = new char[5][15];
int max = 0;
for (int i = 0; i < 5; i++) {
String str = bf.readLine();
if(max < str.length()) max = str.length();
for (int j = 0; j < str.length(); j++) {
arr[i][j] = str.charAt(j);
}
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < max; i++) {
for (int j = 0; j < 5; j++) {
if(arr[j][i] == '\0') continue;
sb.append(arr[j][i]);
}
}
System.out.println(sb);
}
}
728x90
반응형