포럼
문제 ICPC00387

K. Kitten of Chaos

설명

Karen has a beautiful precious glass object on the shelf in her living room. Unfortunately, her cat Klaus does not like it when there is stuff on his favourite shelf. Everything that is not bolted or glued in place, he will gradually push over the edge while looking Karen straight in the eyes.

Now, Klaus' paw slowly executes his diabolical deed. His cute fluffy face radiates inadvertent innocence. Knowing that any intervention would only delay the inevitable, Karen wonders what will happen to the string her sister Kim wrote on the precious glass object. After all, it took Kim a whole week to gather all the bdpq letters that make up the string.

Can you describe to Karen what the string will look like from her point of view while it tumbles towards destruction?

While falling off the shelf, Karen's precious glass object is subject to the following transformations, described as seen when looking at the object from the front.
- h: horizontal flip, e.g. bbq becomes pdd
- v: vertical flip, e.g. bbq becomes ppd
- r: 180-degree rotation, e.g. bbq becomes bqq

No flips along or rotations about any other axes are possible.

제약
입력 형식

The input consists of:
- One line with a string \(s\) consisting of the letters bdpq (\(1 \le |s| \le 5\cdot 10^5\)), the string printed on the glass object as seen at the start of the fall.
- One line with a string \(t\) consisting of the letters hvr (\(1 \le |t| \le 5\cdot 10^5\)) giving the sequence of transformations in the order that they occur during the fall.

출력 형식

Output the string that can be seen at the moment the glass object touches the ground and just before it shatters into pieces.

예제 1
입력
bbq
h
출력
pdd
예제 2
입력
bbq
v
출력
ppd
예제 3
입력
bbq
r
출력
bqq
예제 4
입력
ppbddbq
hvrhv
출력
bqppqdd
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC GCPC 2024

평가 및 의견

K. Kitten of Chaos

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

K. Kitten of Chaos

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8