[BOJ] 10798 세로읽기

Time Lapse :5min 3sec

10798.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import java.io.*;

public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
String[] board = new String[5];
int maxlen = 0;
for(int i = 0; i < 5; ++i) {
board[i] = br.readLine();
maxlen = Math.max(maxlen, board[i].length());
}
for(int i = 0; i < maxlen; ++i)
for(int j = 0; j < 5; ++j) {
if (board[j].length() <= i) continue;
bw.write(board[j].charAt(i));
}
bw.flush();
}
}
Author: Song Hayoung
Link: https://songhayoung.github.io/2020/07/30/PS/BOJ/10798/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.