QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 64 MB 總分: 100

#13746. 游戏

统计

Mirko 和 Slavko 在滑雪旅行中感到无聊,于是他们想出了一个可以玩的有趣游戏。

首先,Mirko 指定一个数字 $N$。然后 Slavko 写下他将用于构建自己单词的 $N$ 个字母。接着 Mirko 写下一个由 $N$ 个字母组成的单词。

Slavko 的目标是用他选择的字母构建一个单词,使得该单词中没有任何一个位置的字母与 Mirko 的单词中相同位置的字母相同。

为了让游戏更加刺激,Slavko 必须找到满足条件的字典序最小的单词。这样的单词保证一定存在。

由于 Mirko 和 Slavko 还很年轻,他们只认识 3 个字母:'a'、'b' 和 'c',这极大地限制了他们的编程水平。

输入格式

第一行包含一个正整数 $N$ ($1 \le N \le 5000$)。

第二行包含一个由 $N$ 个小写字母 'a'、'b' 或 'c' 组成的字符串,表示 Slavko 选择的字母。

第三行包含一个由 $N$ 个小写字母 'a'、'b' 或 'c' 组成的字符串,表示 Mirko 写的单词。

输出格式

输出第一行且仅一行,包含 Slavko 找到的单词。

子任务

在价值 40 分的测试数据中,满足 $1 \le N \le 20$。

样例

输入样例 1

3
abc
abc

输出样例 1

bca

输入样例 2

4
baba
baab

输出样例 2

abba

输入样例 3

5
aaabc
abcba

输出样例 3

baaac

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.