-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDay-6.java
More file actions
25 lines (21 loc) · 719 Bytes
/
Day-6.java
File metadata and controls
25 lines (21 loc) · 719 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
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int testCases = scan.nextInt();
for(int i = 0; i < testCases; i++){
char[] inputString = scan.next().toCharArray();
// Print even chars
for(int j = 0; j < inputString.length; j += 2){
System.out.print(inputString[j]);
}
System.out.print(" ");
// Print odd chars
for(int j = 1; j < inputString.length; j += 2){
System.out.print(inputString[j]);
}
System.out.println();
}
scan.close();
}
}