You are viewing a single comment's thread. Return to all 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(); }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 6: Let's Review
You are viewing a single comment's thread. Return to all comments →
JAVA SOLUTION