#include <stdio.h>
#include <string.h>
void build(char *pre,char *in,int len){
if (len<=0)
{
return ;
}
int pos=strchr(in,*pre)-in;
build(pre+1,in,pos);
build(pre+pos+1,in+pos+1,len-pos-1);
printf("%c",*pre);
}
int main(){
char pre[1000],in[1000];
// freopen("1.txt","r",stdin);
while (scanf("%s %s",pre,in)!=EOF)
{
build(pre,in,strlen(pre));
printf("\n");
}
// fclose(stdin);
return 0;
}
/**************************************************************
Problem: 2121
User: admin
Language: C
Result: Accepted
Time:11 ms
Memory:1144 kb
****************************************************************/