9025 - Tree Recovery   

Description

Given two strings which represent the pre-order traversal and the in-order traversal of a binary tree, generate the post-order traversal of the binary tree.

Input

The input consists of several test cases. Each test case has two strings in a line separated by a space. The first string is the pre-order traversal of the binary tree; the second string is the in-order traversal of the binary tree. Each string will contain only capital characters and the characters will be unique.

Output

For each test case, output a string to represent the post-order traversal of the binary tree.

Sample Input  Download

Sample Output  Download

Tags




Discuss