#T367. 求后序遍历

求后序遍历

Description

Given the preorder and inorder traversal sequences of a binary tree, output its postorder traversal sequence.

Input Format

There are two lines of input:

  • The first line contains a string representing the preorder traversal of the tree.
  • The second line contains a string representing the inorder traversal of the tree.
  • All nodes in the tree are represented by lowercase letters.

Output Format

A single line representing the postorder traversal sequence of the tree.

abdec
dbeac

debca