-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday6.java
More file actions
30 lines (27 loc) · 965 Bytes
/
day6.java
File metadata and controls
30 lines (27 loc) · 965 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
29
30
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner in = new Scanner(System.in);
int T = in.nextInt();
in.nextLine();
for (int j = 0; j < T; j++){
String myString = in.nextLine();
char[] myCharArray = myString.toCharArray();
//print even numbers
for(int i = 0; i < myString.length(); i = i + 2 ){
System.out.print(myCharArray[i]);
}
// print the whitespace
System.out.print (" ");
//
for(int i = 1; i < myString.length(); i = i + 2 ){
System.out.print(myCharArray[i]);
}
// Print a newline
System.out.println();
}
in.close();
}
}