#P1030. [NOIP 2001 普及组] 求先序排列

    ID: 30 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>字符串树形结构2001递归NOIp 普及组深度优先搜索,DFS

[NOIP 2001 普及组] 求先序排列

Description

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 8 \le 8).

Input Format

Two lines, each a string of uppercase letters, representing the inorder and postorder traversals of a binary tree.

Output Format

One line containing a string representing the preorder traversal of the binary tree.

BADC
BDCA

ABCD

Hint

[Problem Source]

NOIP 2001 Junior Problem 3.

Translated by ChatGPT 5