#include <iostream>
#include <math.h>
using namespace std;
int main(int argc, char** argv){
  	
string c1,c2,s;
int a1,a2,i;
string niz[100];
bool red=true;

 cout<<"unesite slova bez razmaka:"<<endl;
 cin>>c1,c2;
  
cout<<"unesite broj komada prvog i drugog slova:"<<endl;
cin>>a1>>a2;

if(a1==a2){
	cout<<"string postoji"<<endl;
	i=a1+a2;
	
	for (i=0;i<=a1+a2;i++){
		if(red==false){
			s=c1;
			red=true;
		}
		else if(red==true){
			s=c2;
			red=false;
		}
		niz[i]=s;
	}
	for(i=0;i<=a1+a2;i++){
		cout<<niz[i];
	}
}
else{
	cout<<"nemoguce"<<endl;
}
}