Day 6: Let’s Review | 30 Days of Coding | HackerRank | Java Language

**Before watching this make sure that you’ve tried enough**
Language: Java 7

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {

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

 

If this solution helped you, please share this with your friends.
And if you have anything to say, let me know in the comment section.
More solutions are coming so Like our Facebook page and Subscribe to our YouTube channel to stay connected.

Leave a Comment