475 - 暑訓練習 (2013/07/26) Rujia Liu's Brute F Scoreboard

Time

2013/07/26 12:15:00 2013/07/26 17:15:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

3142 - (*) Another n-Queen Problem   

3143 - (*) Birthday Cake   

3144 - (*) Counting RNA sequences   

3145 - (*) Dancing Digits   

3146 - (*) Equations in Disguise   

3147 - Power Network   

Description

 http://poj.org/problem?id=1459

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss




3148 - Red and Black   

Description

 http://poj.org/problem?id=1979

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss




3149 - Conference   

Description

這題無法在 NTHU OJ 上面 submit,請大家到原本的 OJ 上送 code

 http://acm.timus.ru/problem.aspx?space=1&num=1109

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss




3150 - 小孩報數問題   

Description

 http://poj.org/problem?id=3750

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss




7428 - Tree Recovery   

Description

Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters in the nodes.
This is an example of one of her creations:

To record her trees for future generations, she wrote down two strings for each tree: a preorder traversal (root, left subtree, right subtree) and an inorder traversal (left subtree, root, right subtree). For the tree drawn above the preorder traversal is DBACEGF and the inorder traversal is ABCDEFG.
She thought that such a pair of strings would give enough information to reconstruct the tree later (but she never tried it).

Now, years later, looking again at the strings, she realized that reconstructing the trees was indeed possible, but only because she never had used the same letter twice in the same tree.
However, doing the reconstruction by hand, soon turned out to be tedious.
So now she asks you to write a program that does the job for her!

 

Input

The input file will contain one or more test cases.
Each test case consists of one line containing two strings preord and inord, representing the preorder traversal and inorder traversal of a binary tree. Both strings consist of unique capital letters. (Thus they are not longer than 26 characters.)
Input is terminated by end of file.

 

Output

For each test case, recover Valentine's binary tree and print one line containing the tree's postorder traversal (left subtree, right subtree, root).

 

Sample Input  Download

Sample Output  Download

Tags




Discuss