Home => ProblemSet => 7.1-17:新二叉树
Problem1785--7.1-17:新二叉树

1785: 7.1-17:新二叉树

Time Limit: 1 Sec  Memory Limit: 128 MB  Submit: 0  Solved: 6
[ Submit ] [ Status ] [ Creator: ][ 参考程序 ]

Description

输入一串二叉树,输出其前序遍历。

Input

第一行为二叉树的节点数 n。(1≤n≤26)
后面 n 行,每一个字母为节点,后两个字母分别为其左右儿子。特别地,数据保证第一行读入的节点必为根节点。
空节点用 * 表示

Output

二叉树的前序遍历。

Sample Input Copy

6
abc
bdi
cj*
d**
i**
j**

Sample Output Copy

abdicj

Source/Category