QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 32 MB Total points: 100

#16424. 爆炸

Statistics

Mirko 喜欢玩字符串,但这一次他玩得太过了——他在字符串中放入了一个“爆炸”!爆炸是一个字符序列,如果它靠近火源,就会爆炸并引发链式反应。

Mirko 还是一如既往地粗心,他忘记了字符串中包含爆炸,并将其放在了烛光旁。于是,链式反应开始了。

链式反应按以下方式进行:

  • 如果字符串中包含爆炸字符序列,它们都会爆炸,并且通过拼接不含爆炸部分的其他片段来形成一个新字符串。
  • 这种拼接可能会产生新的爆炸。
  • 只要字符串中还存在爆炸字符序列,链式反应就会不断重复。

现在 Mirko 想知道在这一系列链式反应之后,是否还会剩下任何东西。如果什么都没有留下,输出 FRULA(不加引号)。如果还剩下一些东西,输出所有反应结束后最终剩下的字符串。

请注意:爆炸字符串中不会包含两个相同的字符。

输入格式

输入的第一行包含 Mirko 的字符串,($(1 \le |\text{Mirko's string}| \le 1\,000\,000)$)。

输入的第二行包含爆炸字符串,($(1 \le |\text{explosion}| \le 36)$)。

Mirko 的字符串和爆炸字符串都仅由英文大写字母、小写字母和数字 $0, 1, \dots, 9$ 组成。

输出格式

输出的第一行也是唯一的一行,必须包含如题所述在所有反应结束后最终剩下的字符串。

数据范围

在占总分 $50\%$ 的测试数据中,Mirko 的字符串长度 $N$ 将不超过 $3000$。

样例

输入样例 1

mirkovC4nizCC44
C4

输出样例 1

mirkovniz

输入样例 2

12ab112ab2ab
12ab

输出样例 2

FRULA

说明

第二个样例的解释:

首先,位于位置 1 和 6 的炸弹爆炸。然后我们剩下 ****1****2ab(其中 * 表示爆炸的字符),当这个字符串拼接在一起时,我们得到 12ab。不幸的是,这又是一个爆炸,因此它也消失了。

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.