COCI '16 Contest 7 #3 Igra

View as PDF

Submit solution


Points: 10 (partial)
Time limit: 1.0s
Memory limit: 64M

Problem type

Mirko and Slavko are bored on their skiing trip, so they came up with an interesting game they could play. First, Mirko specifies a number N. Then Slavko writes N letters he will use to create his word. Then Mirko writes a word consisting of N letters. Slavko's goal is to create a word using the letters he chose, but so that not a single letter in his word matches the letter at the same position in Mirko's word. In order to make the game even more intense, Slavko must find the lexicographically smallest such word. This word will surely exist. Since Mirko and Slavko are still young, they know only 3 letters: a, b, and c, which greatly affects their programming skills.

Input Specification

The first line of input contains the positive integer N (1 \leq N \leq 5\,000).

The following line contains a string of N lowercase letters a, b, or c, the letters Slavko chose.

The third line contains a string of N lowercase letters a, b, or c, the word Mirko wrote.

Output Specification

The first and only line of output must contain the word Slavko found.

Scoring

In test cases worth 40 points in total, it will hold 1 \leq N \leq 20.

Sample Input 1

3
abc
abc

Sample Output 1

bca

Sample Input 2

4
baba
baab

Sample Output 2

abba

Sample Input 3

5
aaabc
abcba

Sample Output 3

baaac

Comments

There are no comments at the moment.