#include <bits/stdc++.h>
#define quick ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define pii pair <int,int>
#define pll pair <ll,ll>
#define INF 1000000000
#define mod 1000000007
#define size(a) ((int)(a.size()))
using namespace std;
void solv()
{
string s,ss;
cin>>s>>ss;
if(s==ss)
{
cout<<s<<endl;
return;
}
if(size(s)!=size(ss) || size(s)%2)
{
cout<<-1<<endl;
return;
}
for(int i=0,j=size(s)/2;j<size(s);i++,j++)
{
if(s[i]!=s[j])
{
cout<<-1<<endl;
return;
}
}
for(int i=0,j=size(ss)/2;j<size(ss);i++,j++)
{
if(ss[i]!=ss[j])
{
cout<<-1<<endl;
return;
}
}
for(int i=size(s)/2;i<size(s);i++) cout<<ss[i];
for(int i=size(s)/2;i<size(s);i++) cout<<s[i];
cout<<endl;
}
int main()
{
quick
int TT=1; // cin>>TT;
while(TT--) solv();
return 0;
}
Copy