吴晨曦 • 6个月前
#include <bits/stdc++.h>
using namespace std;
string pre, inor;
void work(string pre, string inor) {
if (pre.empty())
return;
char root = ____;
int k = inor.find(____);
pre.erase(pre.begin());
string leftpre = pre.substr(____, ____);
string rightpre = pre.substr(____);
string leftinor = inor.substr(____, ____);
string rightinor = inor.substr(____, ____);
work(leftpre, leftinor);
work(rightpre, rightinor);
printf("%c", root);
}
int main() {
cin >> inor >> pre;
work(____, ____);
return 0;
}
评论: