这是代码
#include <bits/stdc++.h>
using namespace std;
int a[100000005];
void dfs(string mid, string af) {
int len = mid.size();
char root = af[len - 1];
if (len == 0)
return;
cout << root;
int pos = mid.find(root);
dfs(mid.substr(0, pos), af.substr(0, pos));
dfs(mid.substr(pos + 1, len - 1), af.substr(pos + 1, len - pos - 1));
}
int main() {
string a, b;
cin >> a >> b;
dfs(a, b);
return 0;
}