[백준] 10798 | 세로읽기(java) - 틀린 이유를 모르겠어요ㅠㅠㅠ

Yuri Lee·2023년 9월 24일
0

코딩테스트

목록 보기
1/7

백준 세로읽기 문제 >> https://www.acmicpc.net/problem/10798

로컬에서 테스트했을때 작동이 잘 되는데도 불구하고 제출하면 틀렸다고 하는 이유가 몰까요ㅠㅠㅠ

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

public class Main {

	public static void main(String[] args) throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] arr = new String[5];
		String[][] arr_split = new String[5][15];

		for(int i=0; i<5; i++){
			System.out.printf("1-15자의 글자 또는 숫자 입력(%d줄) : ",i+1);
			
            arr[i] = br.readLine().trim();
		}
		
		for(int i=0; i<5;i++){
			for(int j=0; j<arr[i].length();j++){
				arr_split[i][j] = String.valueOf(arr[i].charAt(j));
			}
		}

		for(int i=0; i<15; i++){
			for(int j=0; j<5;j++){
				if(arr_split[j][i]==null){
					System.out.print("");
				}else{
					System.out.print(arr_split[j][i]);
					}
			}
		}
	}

}
profile
유리

0개의 댓글