Logo
(追記) (追記ここまで)

31109번 - Mirror Brackets 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB538832.000%

문제

Let's remind you what a correct bracket sequence (CBS) is.

  • An empty string is CBS.
  • If $s$ is CBS, then ($s$) and [$s$] also are CBS.
  • If $s$ and $t$ are CBS, then $st$ also is CBS.
  • If a sequence can't be obtained applying the rules given above, then it is not a 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.

제한

예제 입력 1

(qbpoxd)[qbpoxd]

예제 출력 1

bxoqdpdpboxq

예제 입력 2

d[xd(bx)op]q()[]xx

예제 출력 2

dxqxqobqxx

힌트

출처

Contest > Open Cup > 2020/2021 Season > Stage 16: Grand Prix of Urals M번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /