-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day6.java
32 lines (26 loc) · 866 Bytes
/
Day6.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
import java.io.*;
import java.util.*;
public class Solution {
static void sol( String str){
String odd = "", even = "" ;
for( int j=0 ; j<str.length() ; j++ ){
if( j%2 == 0 ){
even += str.charAt(j) ;
}
else{
odd += str.charAt(j) ;
}
}
System.out.println(even + " " + odd) ;
}
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 input = new Scanner(System.in) ;
int t = input.nextInt() ;
String str ;
for( int i=0 ; i<t ; i++ ){
str = input.next() ;
sol(str) ;
}
}
}