Algorithm

[BAEKJOON] 10798번: 세로읽기

Y06 2022. 8. 1. 21:57

클릭하면 문제로 이동

import java.io.*;

public class algo_10798 {
	public static void main(String[] args) throws IOException {
		char[][] ch = new char[5][15];
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		for(int i=0; i < ch.length; i++) {
			String str = br.readLine();
			
			for(int j=0; j < str.length(); j++) {
				ch[j][i] = str.charAt(j);
			}
		}
		
		for(int i=0; i < 15; i++) {
			for(int j=0; j < 5; j++) {
				if(ch[j][i] == ' ' || ch[j][i]== '\0' ) continue;
				
				System.out.print(ch[i][j]);
			}
		}
	}
}