#include<bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
#define all(x) x.begin(),x.end()
#define sc(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define LL long long
#define LD long double
#define pb push_back
#define F first
#define S second
const double PI=3.1415926535897932384626433;
const int KL=1e6;
const LL MOD=1e9+7;
using namespace std;
/*
typedef complex<double> point;
#define x real()
#define y imag()
*/
LL q,x,y,z,n,m,a[KL],mn=1e9,mx=-1e9,ans;
vector <LL> vec;
set <LL> s;
map <LL,LL> mp;
int main()
{
string s,t;
cin>>s>>t;
if((s.size()+t.size())%2!=0){
cout<<-1<<endl;
return 0;
}
if(s==t){
cout<<s<<endl;
return 0;
}
n=s.size();
m=t.size();
int tot=(n+m)/2;
for(int i=0;i<n;i++){
if(i+1>tot)continue;
int sz=tot-(i+1);
if(sz>m)continue;
string ret,ret2;
for(int j=0;j<sz;j++)ret+=t[j];
for(int j=0;j<=i;j++)ret+=s[j];
for(int j=sz;j<m;j++)ret2+=t[j];
for(int j=i+1;j<n;j++)ret2+=s[j];
if(ret==ret2){
cout<<ret<<endl;
return 0;
}
}
if(m>=tot){
string ret,ret2;
for(int j=0;j<tot;j++){
ret+=t[j];
}
for(int j=tot;j<m;j++){
ret2+=t[j];
}
for(int i=0;i<n;i++)ret2+=s[i];
if(ret==ret2){cout<<ret<<endl;return 0;}
}
cout<<-1<<endl;
return 0;
}
Copy