We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Tutorials
  3. 30 Days of Code
  4. Day 6: Let's Review
  5. Discussions

Day 6: Let's Review

Problem
Submissions
Leaderboard
Discussions
Editorial
Tutorial

    You are viewing a single comment's thread. Return to all comments →

  • srikanthgade1818
    2 months ago+ 1 comment

    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 scn=new Scanner(System.in);
    
        int t=scn.nextInt();
       //scn.nextLine();
        for(int j=0;j<=t;j++){
        String s=scn.next();
        String even="";
        String odd="";
        for(int i=0;i<s.length();i++){
            if(i%t==0){
                even+=s.charAt(i);
                //System.out.println(even);
                }
            else {
             odd+=s.charAt(i);}//System.out.println(even+" "+odd);
        }
                         System.out.println(even+" "+odd);      any one check this code i got a reun time expectation i go
    
        }
    
        }
    

    }

    0|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy