#include<cstdio>
#include<string>
using namespace std;
string readstr(int mode){
string ans="";
char tmp;
while(1){
tmp=getchar();
if(!(tmp>=33&&tmp<=126)&&mode==1||(tmp=='\n'||tmp=='\r'||tmp==EOF)&&mode==2||tmp==EOF&&mode==3)
break;
else
ans+=tmp;
}
return ans;
}
void writestr(string a){
for(int i=0;i<a.size();i++)
putchar(a[i]);
}
string work(string b,string c){
if(b.size()<=1)
return b;
char root=c[c.size()-1];
int root_pos=b.find(root);
string leftb=b.substr(0,root_pos);
string leftc=c.substr(0,root_pos);
string rightb=(root_pos+1>=b.size()?"":b.substr(root_pos+1,b.size()-root_pos-1));
string rightc=c.substr(root_pos,b.size()-root_pos-1);
return root+work(leftb,leftc)+work(rightb,rightc);
}
int main(void){
string b,c;
b=readstr(2);
c=readstr(2);
writestr(work(b,c));
return 0;
}