1094: 二叉树的创建及遍历

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:204 Solved:119

Description

使用“扩展先序遍历序列”,根据读入的字符创建二叉树。并输出对应的中序遍历、后续遍历结果。

Input

一行符合“扩展先序遍历序列”的字符串

Output

共两行,
第一行,对应的中序遍历结果
第二行,对应的后续遍历结果

Sample Input Copy

ABD..EG..H..C.FI...

Sample Output Copy

DBGEHACIF
DGHEBIFCA

Source/Category