[백준, BOJ 10798] 세로읽기 (java)
Problem Solving/BOJ

[백준, BOJ 10798] 세로읽기 (java)

728x90

https://www.acmicpc.net/problem/10798

메모리: 14,352 KB , 시간: 100 ms

사용 알고리즘: 구현, 문자열

728x90

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception{

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[] strArr = new String[5];
        for (int i = 0; i < 5; i++) {
            strArr[i] = br.readLine();
        }

        StringBuilder result = new StringBuilder();
        for (int i = 0; i < 15; i++) {
            for (int j = 0; j < 5; j++) {
                if(i < strArr[j].length()) result.append(strArr[j].charAt(i));
            }
        }
        System.out.println(result);
    }
}
728x90