-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday6of30daysofcode
More file actions
28 lines (25 loc) · 899 Bytes
/
day6of30daysofcode
File metadata and controls
28 lines (25 loc) · 899 Bytes
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
import java.io.*;
import java.util.*;
public class Solution {
private static final Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
int cases = scanner.nextInt();
for(int i = 0; i < cases; i++){
String s = scanner.next();
int l = s.length();
String even = new String();
String odd = new String();
for(int j = 0; j < l; j++){
if(j % 2 == 0){
even = even + Character.toString(s.charAt(j));
}
else{
odd = odd + Character.toString(s.charAt(j));
}
}
System.out.println(even + " " + odd);
}
scanner.close();
}
}