[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