QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 1024 MB Puntuación total: 100

#12147. 混沌小猫

Estadísticas

Karen 在客厅的架子上有一个精美的玻璃工艺品。不幸的是,她的猫 Klaus 不喜欢架子上有东西。任何没有固定或粘好的东西,它都会一边直勾勾地盯着 Karen,一边慢慢地将其推下边缘。

现在,Klaus 的爪子正在缓慢地执行它的邪恶行径。它那毛茸茸的可爱脸庞散发着一种不经意的无辜感。Karen 知道任何干预都只会推迟不可避免的结果,于是她想知道她姐姐 Kim 写在玻璃工艺品上的字符串会发生什么变化。毕竟,Kim 花了整整一周的时间才收集齐组成该字符串的 bdpq 字母。

你能描述一下在玻璃工艺品坠向毁灭的过程中,从 Karen 的视角看去,这个字符串会变成什么样吗?

在从架子上掉落的过程中,Karen 的玻璃工艺品会经历以下变换(从正面观察):

  • h:水平翻转,例如 bbq 变为 pdd
  • v:垂直翻转,例如 bbq 变为 ppd
  • r:180 度旋转,例如 bbq 变为 bqq

除此之外,不存在其他轴向的翻转或旋转。

Klaus,在一次幸运地被 Karen 的保险覆盖的事件发生前 10 秒。

输入格式

输入包含: 一行包含一个由字母 bdpq 组成的字符串 $s$ ($1 \le |s| \le 5 \cdot 10^5$),这是坠落开始时在玻璃工艺品上看到的字符串。 一行包含一个由字母 hvr 组成的字符串 $t$ ($1 \le |t| \le 5 \cdot 10^5$),给出了坠落过程中发生的变换序列。

输出格式

输出玻璃工艺品在触地前瞬间所呈现的字符串。

样例

输入 1

bbq
h

输出 1

pdd

输入 2

bbq
v

输出 2

ppd

输入 3

bbq
r

输出 3

bqq

输入 4

ppbddbq
hvrhv

输出 4

bqppqdd

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.