/* Problem description gives a binary tree in the order and sequence. Find out its first order arrangement.
(The Convention tree node is represented in different capitals, the length <=8).
Input format two lines, one string per line, respectively, the middle order and the sequence of output format a string, representing the first order of the sample input BADC BDCA sample output abcd*/import java.util.*;
public class main{public static String x,y,result= "";
public static void Main (string[] args) {Scanner sc=new Scanner (system.in);
X=sc.next ();
Y=sc.next ();
Xianxu (X,y);
SYSTEM.OUT.PRINTLN (result); }//recursive traversal of binary tree sequence and subsequent public static void Xianxu (String center,string last) {if (Center.length () ==0 && last.length
() ==0) {return;
else{//The last word of the sequence Poute int length=last.length ();
The last character of the sequence, that is, the root node String ls=last.substring (Last.length ()-1);
The first sequence, which is the root node result+=ls, is transformed into a first order;
The root node is subscript int index=center.indexof (LS) at the center of the sequence;
if (index>0) {//recursively traverses and transforms the left subtree of the root node Xianxu (center.substring (0,index), last.substring (0,index)); } if (length>1) {//recursively traverse and convert the right subtree of the root node Xianxu (center.substring (index+1,length), last.substring (index,length-1))
; }
}
}
}