题目
代码
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
char in[100];
char pre[100];
int len=0;
void postorder(char in[],char pre[],int len)
{
if (len <= 0)return;
char root = pre[0];
int i = 0;
for ( i = 0; i < len; i++)
{
if (root == in[i])break;
}
postorder(in, pre + 1, i);
postorder(in + i + 1, pre + i + 1, len - i - 1);
printf("%c", root);
}
int main()
{
string a, b;
cin >> a >> b;
len = a.length();
for (int i = 0; i < a.length(); i++)
in[i] = a[i];
for (int i = 0; i < b.length(); i++)
pre[i] = b[i];
postorder(in, pre, len);
}