12768 - 電機資結 2020 HW3 Tree Anagrams   

Description

Anagrams is "變位字" in Chinese

Our "Tree Anagrams" definition is as follows:

Not All Anagrams are Valid Trees.  For example, if we want "EARTH" to be the level-order sequence and "HEART" to be the in-order sequence, the tree does not exist.

 

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss