[구현] BOJ_10798 세로읽기 "JAVA"

라리·2021년 10월 8일
0

코딩테스트

목록 보기
22/29

🚀링크

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

💻문제

🌏문제풀이

👩‍💻코드

package javaTest;

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

public class BOJ_10798 {

	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = null;
		
		String[] board = new String[5];
		int maxSize = Integer.MIN_VALUE;
		
		for(int i=0; i<5; i++) {
			st = new StringTokenizer(br.readLine());
			board[i] = st.nextToken();
			maxSize = Math.max(maxSize, board[i].length());
		}
			
		for(int i=0; i<maxSize; i++) {
			for(int j=0; j<5; j++) {
				if(i < board[j].length()) {
					System.out.print(board[j].charAt(i));
				}
			}
		}
		

	}

}

0개의 댓글