• + 3 comments

    This is also passing all the testcases and also reducing the time complexities as both the loops only have to run for (in.length()/2) times...!!!!

    public class Solution {

    public static void main(String[] args) {
    
        Scanner sc=new Scanner(System.in);
       int t=sc.nextInt();
        for(int j=0;j<t;j++)
            {
        String in = sc.next();
    
        for( int i=0;i<in.length() ;i=i+2)
            {  System.out.print(in.charAt(i));
            }
            System.out.print(" ");
            for(int i=1;i<in.length();i=i+2)
                {
                     System.out.print(in.charAt(i));
                }
            System.out.println();
            }
    
    }
    

    }