-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day 6.java
36 lines (30 loc) · 872 Bytes
/
Day 6.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
s.nextLine();
for (int i = 0; i < t; i++)
{
String str = s.nextLine();
char[] charArray = str.toCharArray();
for (int j = 0; j < charArray.length; j++)
{
if (j % 2 == 0)
{
System.out.print(charArray[j]);
}
}
System.out.print(" ");
for (int j = 0; j < charArray.length; j++)
{
if (j % 2 != 0)
{
System.out.print(charArray[j]);
}
}
System.out.println();
}
}
}