시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB1510969.231%

## 문제

Consider the following sequence of operations on a binary search tree of letters

Remove the leaves and list the data removed
Repeat this procedure until the tree is empty

Starting from the tree below on the left, we produce the sequence of trees shown, and then the empty tree

by removing the leaves with data

BDHPY
CM
GQ
K

Your problem is to start with such a sequence of lines of leaves from a binary search tree of letters and output the preorder traversal of the tree.



## 예제 출력 1

KGCBDHQMPY
BAC