Problem : Given a string S, of length N that is indexed from 0 to N-1 , print its even-indexed and odd-indexed characters as space-separated strings on a single line i.e. if String is Hacker Output should be Hce akr.I wrote this code...
#include
using namespace std;
int main() {
int T;
cin>>T;
string str;
string evenStr;
string oddStr;
for(int i=1; i<=T; i++)
{
cin>>str;
for(int j=0;j For input T=2 and two strings "Hacker" "Rank"...this code Outputs "Hce akr" "HceRn akrak"But this code prints the correct result...Why?
#include
using namespace std;
int main() {
int T;
cin>>T;
for(int i=1; i<=T; i++)
{ string str;
string evenStr;
string oddStr;
cin>>str;
for(int j=0;j For input T=2 and two strings "Hacker" "Rank"... Correct Output: "Hce akr" " Rn ak"
