#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define endl '\n';
#define mp make_pair
#define pb push_back
void solve (){
string a,b;
cin>>a>>b;
if(a.size()%2 || b.size()%2){
cout<<-1;
return;
}
string aa,bb;
int l=0,r=a.size()/2;
while (r!=a.size()){
if(a[r]!=a[l]){
cout<<-1;
return;
}
else aa+=a[l];
l++;
r++;
}
l=0,r=a.size()/2;
while (r!=b.size()){
if(b[r]!=b[l]){
cout<<-1;
return;
}
else bb+=b[l];
l++;
r++;
}
cout<<bb+aa;
}
int main ()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//freopen ("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int t=1;
//cin>>t;
while (t--)
solve();
return 0;
}
Copy