ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 백준 10798 JAVA
    ETC/Algorithm 2023. 5. 20. 00:42
    import java.io.*;
    
    public class Main {
        public static void main(String[] args) throws IOException {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
    
            char[][] arr = new char[5][15];
    
            int max = 0;
            for (int i = 0; i < 5; i++) {
                String s = br.readLine();
                int lineLen = s.length();
                if (lineLen > max) {
                    max = lineLen;
                }
                for (int j = 0; j < lineLen; j++) {
                    arr[i][j] = s.charAt(j);
                }
            }
    
            for (int i = 0; i < max; i++) {
                for (int j = 0; j < 5; j++) {
                    if (arr[j][i] == '\0') continue;
                    bw.write(arr[j][i]);
                }
            }
            bw.flush();
        }
    }
    

    댓글

Designed by black7375.