Ksenia and Pan Scales

题意翻译

一架天平,中间有一个'|'作为分隔符,分割左盘和右盘.天平上面放有一些字母,下面你也准备放上去一些字母使得天平平衡.每个字母的重量都是1.如果无法把下面一行的所有字母放到天平上去输出"Impossible",否则输出任意一种使得天平平衡的方案. Translated by @Fuko_Ibuki

题目描述

Ksenia has ordinary pan scales and several weights of an equal mass. Ksenia has already put some weights on the scales, while other weights are untouched. Ksenia is now wondering whether it is possible to put all the remaining weights on the scales so that the scales were in equilibrium. The scales is in equilibrium if the total sum of weights on the left pan is equal to the total sum of weights on the right pan.

输入输出格式

输入格式


The first line has a non-empty sequence of characters describing the scales. In this sequence, an uppercase English letter indicates a weight, and the symbol "|" indicates the delimiter (the character occurs in the sequence exactly once). All weights that are recorded in the sequence before the delimiter are initially on the left pan of the scale. All weights that are recorded in the sequence after the delimiter are initially on the right pan of the scale. The second line contains a non-empty sequence containing uppercase English letters. Each letter indicates a weight which is not used yet. It is guaranteed that all the English letters in the input data are different. It is guaranteed that the input does not contain any extra characters.

输出格式


If you cannot put all the weights on the scales so that the scales were in equilibrium, print string "Impossible". Otherwise, print the description of the resulting scales, copy the format of the input. If there are multiple answers, print any of them.

输入输出样例

输入样例 #1

AC|T
L

输出样例 #1

AC|TL

输入样例 #2

|ABC
XYZ

输出样例 #2

XYZ|ABC

输入样例 #3

W|T
F

输出样例 #3

Impossible

输入样例 #4

ABC|
D

输出样例 #4

Impossible