• + 0 comments

    JAVA SOLUTION

    Scanner sc = new Scanner(System.in);
            int T = sc.nextInt();
            sc.nextLine();
            for (int t = 0; t < T; t++) {
                String st = sc.nextLine();
                char[] ch = st.toCharArray();
                for (int i = 0; i < st.length(); i++) {
                    if (i % 2 == 0) {
                        System.out.print(ch[i]);
                    }
                }
                System.out.print(" ");
                for (int i = 0; i < st.length(); i++) {
                    if (i % 2 != 0) {
                        System.out.print(ch[i]);
                    }
                }
                System.out.println();
            }