题目描述
blablabla
样例
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
string str1,str2;
void solve(string s1,string s2)
{
if(s1.size()==1)
{
cout<<s1;
return;
}
if(s1.empty()) return;
string l1,l2,r1,r2;
char root = s1[0];
int pos;
for(int i=0;i<s2.size();i++)
{
if(s2[i]==root) pos = i;
}
//pos = 左边节点个数
l1 = s1.substr(1,pos);
r1 = s1.substr(pos+1,s1.size()-pos-1);
l2 = s2.substr(0,pos);
r2 = s2.substr(pos+1,s2.size()-pos-1);
solve(l1,l2);
solve(r1,r2);
cout<<root;
}
int main()
{
while(cin>>str1>>str2)
{
solve(str1,str2);
cout<<'\n';
}
return 0;
}
```