给出一棵二叉树的前序和中序遍历,求它的后序遍历。(树结点用不同的大写字母表示,长度小于等于26。)
Input
本问题有多组测试数据,每组测试数据有两行,每行都是由大写字母组成,分别表示一颗二叉树的前序和中序遍历。
Output
根据给定的前序和中序遍历,输出相应的后序遍历。
Sample Input
ABCD
BADC
Sample Output
BDCA
#include<bits/stdc++.h>
using namespace std;
const int MAXN=100005;
int tot,root,n,l;
char a[MAXN],b[MAXN];
struct tree_node
{
int ch[2];
char num;
}t[MAXN];
int dfs(int l,int r,