An image consists of a number of lines that have been encoded in the following way. We select a separator that does not occur in the original image. We then cut each line of the original image in two segments that do not necessarily need to have the same length, swap the order of the two segments and place the separator in between them. This way, the image
abcde fghij klmno pqrst uvxxy
can, for example, be encoded as
cde|ab j|fghi lmno|k st|pqr uvxxy|
using a vertical line (|) as a separator. Your task is to decode an encoded image.
The first line contains the character that is used as a separator. The second line contains a number $$t \in \mathbb{N}_0$$. This is followed by another $$t$$ lines that each contain the separator just once.
Input:
|
26
| oooo$$$$$$$$$$$$oooo
| oo$$$$$$$$$$$$$$$$$$$$$$$$o
$o o$ $$ o$ | oo$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$o $$ $$ $$o$ | o $ oo o$$$$$$$$$$$$$$$$$$$$
$$$o$$o$ |oo $ $ "$ o$$$$$$$$$ $$$$$$$$$$$$$ $$$$$$$$$o
$$$$$$$o $$$$$$$$ |"$$$$$$o$ o$$$$$$$$$ $$$$$$$$$$$ $$$
$$ | $$$$$$$ $$$$$$$$$$$ $$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$ """$$$ | $$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$
$$$$$$$$$ "$$$ | "$$$""""$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$ "$$$o | $$$ o$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$o | o$$" $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" "$$$$$$ooooo$$$$o | $$$ $$$$$$$$$$$$$$$$
$$$oooo$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ o$$$$$$$$$$$$$$$$$| o
$$$$$$$$$$$$$$$$$$ $$$$"""""""" | $$$$$$$$"$$$$ $$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$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