Source Code
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
typedef long long ll;
        
        
        
	int main(){
		
		string a,b;
		cin>>a>>b;
		
		string a1="",a2="";
		for(int i=0;i<int(a.size());i++){
			if(i<int(a.size())/2)a1+=a[i];
			else a2+=a[i];
			}
		if(a1!=a2){cout<<-1;return 0;}
		
		string b1="",b2="";
		for(int i=0;i<int(b.size());i++){
			if(i<int(b.size())/2)b1+=b[i];
			else b2+=b[i];
			}
		if(b1!=b2){cout<<-1;return 0;}
		
		cout<<b1<<a1;
		
	return 0;
	}
Copy
Right into Two Bahaa
GNU G++17
0 ms
492 KB
Wrong Answer