본문으로 바로가기

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

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 


 

import java.io.*;

public class Solution {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int T = Integer.parseInt(br.readLine());
		for (int t = 1; t <= T; t++) {
			String[] words = new String[5];
			int maxLen = 0;
			
			for (int i = 0; i < 5; i ++) {
				words[i] = br.readLine();
				maxLen = Math.max(maxLen, words[i].length());
			}
			
			String answer = "";
			for (int i = 0; i < maxLen; i++) {
				for (int j = 0; j < 5; j++) {
					if (i >= words[j].length())
						continue;
					answer += words[j].charAt(i);
				}
			}
			
			System.out.println("#" + t + " " + answer);
		}
	}
}