#STSC1C. [STSC OI - 1C] 二叉树 (binary)
[STSC OI - 1C] 二叉树 (binary)
Description
Given the preorder and inorder traversal sequences of a binary tree, output its postorder traversal.
Input
The input consists of two lines.
Line : The preorder traversal of the binary tree.
Line : The inorder traversal of the binary tree.
Output
Output one line containing the postorder traversal of the binary tree.
ABCD
CBAD
CBDA
Hint
For of the test cases, the input string length is , containing only uppercase letters.
The data guarantees a valid solution.
【Sample #1 Explanation】
The binary tree structure is as follows:
A
/ \
B D
/
C