Hackerrank | 30 days of code | Day 6-Solution in c++| Let's-Review-hackerrank-Solution-in-c++


Hackerrank | 30 days of code | Day 6-Solution in c++| Let's-Review-hackerrank-Solution-in-c++

Hackerrank Solution 30-days-of-code
https://www.hackerrank.com/challenges/30-review-loop/problem
Day 3: Let's Review. Solution in Cpp
#include <iostream> #include <cmath> #include <cstdio> #include <vector> #include <algorithm> using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int N; cin >> N; for (int i = 0; i < N; i++) { string str; cin >> str; for (int j = 0; j < str.length(); j++) { if (j % 2 == 0) { cout << str[j]; } } cout << " "; for (int j = 0; j < str.length(); j++) { if (j % 2 != 0) { cout << str[j]; } } cout << endl; } return 0; }

Post a Comment

0 Comments