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