#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
using namespace std;
struct Tree
{
char num;
Tree *left=NULL,*right=NULL;
};
char a[100],b[100];
int len;
void dfs(Tree *k)
{
if(k==NULL) return;
dfs(k->left);
cout<<k->num;
dfs(k->right);
}
Tree *build(char *x,char *y,int l)
{
Tree *node = NULL;
for(int i=0;i<l;i++)
{
// cerr<<"Running"<<endl;
if(x[0]==y[i])
{
node = new Tree();
node->num=x[0];
node->left = build(x+1,y,i);
node->right = build(x+i+1,y+i+1,l-i+1);
}
}
return node;
}
int main()
{
string s1,s2;
getline(cin,s1);
getline(cin,s2);
len=s1.size();
for(int i=0;i<len;i++)
{
a[i]=s1[i];
b[i]=s2[i];
}
Tree *root = build(a,b,len);
dfs(root);
return 0;
}