#include <cstddef>
#include <iostream>
#include <cstring>
using namespace std;
struct Bitree{
char data;
struct Bitree* lchild;
struct Bitree* rchild;
Bitree(char x):data(x),lchild(NULL),rchild(NULL){}
};
Bitree* buildT(string front,string mid){
if(front==""||mid=="") return NULL;
Bitree* r=new Bitree(front[0]);
char n=front[0];
int loc=mid.find(n);
r->data=n;
r->lchild=buildT(front.substr(1,loc),
mid.substr(0,loc));
r->rchild=buildT(front.substr(loc+1),
mid.substr(loc+1));
return r;
}
void backorder(Bitree* root){
if(root==NULL) return;
backorder(root->lchild);
backorder(root->rchild);
cout<<root->data;
}
int main() {
string f,m;
while(cin>>f>>m){
Bitree* r= buildT(f, m);
backorder(r);
cout<<endl;
}
}