본문 바로가기
Algorithm

[BAEKJOON] 10798번: 세로읽기

by Y06 2022. 8. 1.

클릭하면 문제로 이동

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]);
			}
		}
	}
}

'Algorithm' 카테고리의 다른 글

[Programmers] 약수의 개수와 덧셈  (0) 2022.03.14
[Programmers] 부족한 금액 계산하기  (0) 2022.03.14
[Programmers] 두 정수 사이의 합  (0) 2022.03.12
[Programmers] K번째 수  (0) 2022.01.17
[Programmers] 중복 제거하기  (0) 2022.01.17