Codeforces Round 224 (Div. 2)
A
Ksenia and Pan Scales
Codeforces
1100
原题
←B →
翻译中…

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.

翻译中…

Input

翻译中…

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.

翻译中…

Output

翻译中…

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.

翻译中…

样例

Input #1
AC|T
L
Output #1
AC|TL
InputCopy OutputCopy
Input #2
|ABC
XYZ
Output #2
XYZ|ABC
InputCopy OutputCopy
Input #3
W|T
F
Output #3
Impossible
InputCopy OutputCopy
Input #4
ABC|
D
Output #4
Impossible
InputCopy OutputCopy
题目信息
题号
382A
时间限制
1 s
内存限制
256 MB
标签
贪心
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。