#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define x first
#define y second
#define sz(u) (int)(u.size())
#define ld long double
#define all(u) u.begin(),u.end()
using namespace std;
int main()
{
ios::sync_with_stdio(0); cin.tie(0);
string a,b; cin>>a>>b;
int c=a.length(), d=b.length();
if(c%2!=d%2){
cout<<-1<<endl;
return 0;
}
int l = (c+d)/2;
for(int i=0;i<=d;i++){
int need=l-i;
if(need>c) continue;
string tmp1="",tmp2="";
for(int k=0;k<i;k++) tmp2+=b[k];
for(int k=0;k<need;k++) tmp2+=a[k];
for(int k=i;k<d;k++) tmp1+=b[k];
for(int k=need;k<c;k++) tmp1+=a[k];
if(tmp1==tmp2){
cout<<tmp1<<endl;
return 0;
}
}
cout<<-1<<endl;
return 0;
}
Copy