#D7120. Monster Factory
Monster Factory
Monster Factory
Nantendo Co., Ltd. has released a game software called Packet Monster. This game was intended to catch, raise, and fight monsters, and was a very popular game all over the world.
This game had features not found in traditional games. There are two versions of this game, Red and Green, and the monsters that can be caught in each game are different. The monsters that can only be caught by Red are Green. To get it at, use a system called communication exchange. In other words, you can exchange monsters in your software with monsters in your friend's software. This system greatly contributed to the popularity of Packet Monster. ..
However, the manufacturing process for the package for this game was a bit complicated due to the two versions. The factory that manufactures the package has two production lines, one for Red and the other for Red. Green is manufactured in. The packages manufactured in each line are assigned a unique serial number in the factory and collected in one place. Then, they are mixed and shipped by the following stirring device. It is.
The Red package is delivered from the top and the Green package is delivered to this stirrer by a conveyor belt from the left side. The stirrer is made up of two cross-shaped belt conveyors, called "push_down" and "push_right". Accepts two commands. "Push_down" says "Move the conveyor belt running up and down by one package downward", "push_right" says "Move the conveyor belt running left and right by one package to the right" The agitation is done by executing the same number of push_down instructions as the Red package and the push_right instruction, which is one more than the number of Green packages, in a random order. The last instruction to be executed is determined to be "push_right". Under this constraint, the number of Red packages and the number of packages reaching the bottom of the stirrer match, the number of Green packages and the right edge of the stirrer. The number of packages that arrive at matches.
The agitated package finally reaches the bottom or right edge of the conveyor belt, and is packaged and shipped in the order in which it arrives.
An example of a series of stirring procedures is shown below. For simplicity, one package is represented as a one-letter alphabet.
By the way, this factory records the packages that arrived at the lower and right ends of the belt conveyor and their order for the purpose of tracking defective products. However, because this record is costly, the factory manager reached the lower end. I thought about keeping records only for the packages. I thought that the packages that arrived at the right end might be obtained from the records of the packages that were sent to the top and left ends and the packages that arrived at the bottom.
Please help the factory manager to create a program that creates a record of the package that arrives at the far right.
Input
The input consists of multiple datasets. The end of the input is indicated by a- (hyphen) line.
One input consists of a three-line alphabetic string containing only uppercase and lowercase letters. These represent the Red package, the Green package, and the package that reaches the bottom, respectively. Represent. Note that it is case sensitive.
The same character never appears more than once on any line. No character is commonly included on the first and second lines.
The case described in the problem statement corresponds to the first example of Sample Input.
Output
Output the packages that arrive at the right end in the order in which they arrived.
Example
Input
CBA cba cCa X ZY Z
Output
BbA XY
inputFormat
Input
The input consists of multiple datasets. The end of the input is indicated by a- (hyphen) line.
One input consists of a three-line alphabetic string containing only uppercase and lowercase letters. These represent the Red package, the Green package, and the package that reaches the bottom, respectively. Represent. Note that it is case sensitive.
The same character never appears more than once on any line. No character is commonly included on the first and second lines.
The case described in the problem statement corresponds to the first example of Sample Input.
outputFormat
Output
Output the packages that arrive at the right end in the order in which they arrived.
Example
Input
CBA cba cCa X ZY Z
Output
BbA XY
样例
CBA
cba
cCa
X
ZY
Z
-
BbA
XY
</p>