Saturday, 1 April 2017

Hacker Rank Solution Program In C++ For " Day 6: Let's Review "

Problem :- Day 6: Let's Review

Submit Your Solution Here :- Click Here

Copy The Color Code and paste it into hackerrank Editor .

Solution :-

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<cstring>
using namespace std;

int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
    int t;
    cin>>t;
    while(t--)
        {
        string s;
        cin>>s;
        for(int i=0;i<s.size();i++)
            {
            if(i%2==0)
            cout<<s[i];
            }
        cout<<" ";
        for(int i=0;i<s.size();i++)
            {
            if(i%2!=0)
            cout<<s[i];
            }
        cout<<endl;
    }
    return 0;
}

Output :-

Hacker Rank Solution Program In C++ For " Day 6: Let's Review "

No comments:
Write comments

Recommended Posts × +