| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 53 | 8 | 8 | 32.000% |
Let's remind you what a correct bracket sequence (CBS) is.
($s$) and [$s$] also are CBS.Vasya wrote a correct bracket sequence consisting of brackets "(", ")", "[" and "]". After that Vasya added to some places of the sequence characters "b", "d", "o", "p", "q" and "x". As a result, Vasya got some string $z$.
Now Vasya performs the following operations:
If $z$ has a substring of the form ($s$) (there are no brackets in $s$), then Vasya replaces it with $s$ string's mirror reflection relative to vertical axis. If $z$ contains a substring of the form [$t$] (there are no brackets in $t$ as well), then Vasya replaces it with $t$ string's mirror reflection relative to horizontal axis. For example, substring "(qbpoxd)" will be replaced with "bxoqdp", and substring "[qbpoxd]" will be replaced with "dpboxq".
Vasya performs operations until there are no brackets left in the string.
Calculate by the given $z$ string what result Vasya will have in the end.
The only line contains the $z$ string whose length does not exceed 10ドル^5$ characters, consisting of characters "(", ")","[", "]", "b", "d", "o", "p", "q" and "x". It is guaranteed that all the brackets in $z$ organize a correct bracket sequence. It is also guaranteed that the input data contain at least one letter.
Print the string Vasya will get in the end.
(qbpoxd)[qbpoxd]
bxoqdpdpboxq
d[xd(bx)op]q()[]xx
dxqxqobqxx