#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
const int inf = 1e9;
const ll infll = 1e18;
const int M = 1e9 + 7;
const int N = 4e5;
int main(){
string s, t;
cin >> s >> t;
int n = s.size(), m = t.size();
if((n+m)%2){
puts("-1");
return 0;
}
string ss[2] = {"",""}, tt[2] = {"",""};
int midn = (n+m)/2;
for (int i = 0; i < n; ++i){
int prefLen = i+1;
int lenNow = n - prefLen;
int suffLen = midn - lenNow;
if(suffLen < 0) continue;
ss[0] = s.substr(0, prefLen);
ss[1] = s.substr(prefLen);
tt[0] = t.substr(0, n-suffLen);
tt[1] = t.substr(n-suffLen);
if((tt[1] + ss[1]) == (tt[0] + ss[0])){
cout << (tt[1] + ss[1]) << endl;
return 0;
}
}
puts("-1");
}
Copy