Description
已知一颗二叉树的中序遍历序列和后序遍历序列,求二叉树的深度。
Input
输入数据有多组,输入T,代表有T组数据。每组数据包括两个长度小于50的字符串,第一个字符串表示二叉树的中序遍历,第二个表示二叉树的后序遍历。
Output
输出二叉树的深度。
Sample
Input
2
dbgeafc
dgebfca
lnixu
linux
Output
4
3
C++
/*
time : 2021年6月25日19:14:14
result : accept
author : kirie
tips : null
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#define rep(i,a,n) for(int i=a;i<n;i++)
using namespace std;
const int N=1e4+7;
typedef struct TreeN