Skip to content

Instantly share code, notes, and snippets.

Created August 30, 2016 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4452a59069b6092ae3d164c677573b61 to your computer and use it in GitHub Desktop.
Save anonymous/4452a59069b6092ae3d164c677573b61 to your computer and use it in GitHub Desktop.
Problem with connection
#include <iostream>
using namespace std;
string marge(string a, string b)
{
string c;
if(a.length() <= b.length())
{
for(int i = 0, j = 0; i < a.length(); i++, j++)
{
c += a[i];
c += b[i];
}
}
else
{
for(int i = 0, j = 0; i < b.length(); i++, j++)
{
c += a[i];
c += b[i];
}
}
return c;
}
int main()
{
int n;
string a, b;
cin>>n;
while(n--)
{
cin>>a>>b;
cout<<marge(a,b)<<endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment