407005: GYM102672 M Magical XML

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

M. Magical XMLtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard output

Playing with unknown spells, Maleficent got a scroll with messages from the future. There was an interesting spell in the scroll.


<note>
<to></to>
<from></from>
<heading></heading>
<body></body>
</note>

Maleficent noticed several regularities. In particular: the spell is a balanced parenthesis sequence, in which an opening parenthesis is represented by "<S>", and a closing parenthesis is represented by "</S>", where string S is a non-empty string of lowercase Latin characters.

Maleficent found her old not working spell. She decided to check if it is possible to reorder some characters in it so that it conforms to the same rules as the spell from the scroll from the future. Please, help Maleficent to reorder the characters in her spell in a desired way, or say that it is impossible.

Input

Single line contains string $$$s$$$, consisting of lowercase Latin characters and characters "<", ">" and "/" — Maleficent's spell ($$$1 \le |s| \le 100\,000$$$).

Output

If it is impossible to reorder characters in a desired way, output "Impossible".

Otherwise, output the string, which can be obtained from the source spell by permutation of its characters and conforms to desired rules.

ExamplesInput
<test></test>
Output
<test></test>
Input
test<tist>/<>
Output
Impossible
Input
te<ste>st/<t>
Output
<tset></tset>
Input
<>test<>//<>test<>
Output
<te><st></st></te>

加入题单

上一题 下一题 算法标签: