luogu#P1030. [NOIP 2001 普及组] 求先序排列
[NOIP 2001 普及组] 求先序排列
题目描述
Given the inorder and postorder traversals of a binary tree, find its preorder traversal. (Assume that tree nodes are represented by distinct uppercase letters, and the number of nodes in the binary tree is ).
输入格式
Two lines, each a string of uppercase letters, representing the inorder and postorder traversals of a binary tree.
输出格式
One line containing a string representing the preorder traversal of the binary tree.
样例 1 输入
BADC
BDCA
样例 1 输出
ABCD
说明 / 提示
[Problem Source]
NOIP 2001 Junior Problem 3.
Translated by ChatGPT 5