-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.java
More file actions
23 lines (22 loc) · 832 Bytes
/
Solution.java
File metadata and controls
23 lines (22 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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 number = scanner.nextInt();
for(int i=0; i<number; i++){
String word = scanner.next();
StringBuilder sbEven = new StringBuilder();
StringBuilder sbOdd = new StringBuilder();
for(int j=0; j<word.length(); j++){
if(j % 2 == 0){
sbEven.append(word.charAt(j));
}else{
sbOdd.append(word.charAt(j));
}
}
System.out.println(sbEven + " " + sbOdd);
}
}
}