Deep_Lee

https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWVWgkP6sQ0DFAUO 

 

SW Expert Academy

SW ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์—ญ๋Ÿ‰ ๊ฐ•ํ™”์— ๋„์›€์ด ๋˜๋Š” ๋‹ค์–‘ํ•œ ํ•™์Šต ์ปจํ…์ธ ๋ฅผ ํ™•์ธํ•˜์„ธ์š”!

swexpertacademy.com

 

 


์ž๋ฆฟ์ˆ˜์™€ ๋ฐฐ์—ด์˜ ํ–‰๋ฐ˜๋ณตํ•˜๋Š” for๋ฌธ์˜ i๋ฒ”์œ„๋ฅผ ์กฐ๊ธˆ ํ—ค๋งจ๊ฑฐ๋นผ๊ณ 

๋ฌธ์ œ์ž์ฒด๋Š” ์‰ฌ์› ๋‹ค.

 

 

import java.util.Scanner;
class Solution{
    public static void main(String args[]) throws Exception{
        Scanner kb = new Scanner(System.in);
        int T = kb.nextInt();
        for (int t = 1; t <= T; t++) {
            String[] arr = new String[5];
            for (int i = 0; i < 5; i++) {
                arr[i] = kb.next();
            }
            
            String answer = "";
            for (int i = 0; i <15; i++) { // i๋Š” ์ž๋ฆฟ์ˆ˜ , j๋Š” ๋ฌธ์ž์—ด์˜ ํ–‰
                for (int j = 0; j < 5; j++) {
                    if(i<arr[j].length()){
                        answer+=arr[j].charAt(i);
                    }
                }
            }
            System.out.println("#"+t+" "+answer);
        }
    }
}