#include <iostream> #include <cstring> #include <cstdio> using namespace std; char qianxu[30], zhongxu[30]; void Print_(char* qian, char* zhong, int len){ char ch = *qian;//根节点 if( len == 0 ) return ; int i=0; for(; i<len; i++ ){ if( zhong[i] == *qian ) break ; } Print_(qian+1, zhong, i);//左子树 Print_(qian+i+1, zhong+i+1, len-(i+1) ) ;//右子树 printf("%c",ch); } int main(){ while(~scanf("%s%s",qianxu,zhongxu) ){ Print_(qianxu, zhongxu, strlen(qianxu)); printf("\n"); } return 0; }