• + 0 comments

    For JAVA

    Scanner scan=new Scanner(System.in);

    int N=scan.nextInt();
    scan.nextLine();
    for(int i=0;i<N;i++){
        String s=scan.nextLine();
        for(int j=0;j<s.length();j++){
            if(j%2==0){
                System.out.print(s.charAt(j));
            }
        }
        System.out.print(" ");
        for(int k=0;k<s.length();k++){
            if(k%2!=0){
                System.out.print(s.charAt(k));
            }
        }
        System.out.println();
    }
    
    scan.close();