By All Means


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C++, Java, Python

As Adelaide's best linguist, Ritisha knows every word. Although she tries to love them all equally, there are two words of length n that are her favourite, s and t.

One Sunday afternoon, Ritisha was thinking about s and t. She likes them both so much, but it's difficult to appreciate them at the same time, since they are in fact two different words. She thinks that maybe m, the mean of the two words, could help her do this.

Consider the sorted list of all strings of length n in lexicographical order.

The mean of two words s and t is the middle word in the contiguous segment of this list whose endpoints are s and t (inclusive).

Equivalently, the mean is a word m such that there are equally many words before and after m within this segment, or there is one more word after than before.

For example, the mean of aba and abe is abc, since the relevant portion of the sorted list is:

..., aba, abb, abc, abd, abe, ...

and abc is equidistant from aba and abe.

If the segment contains an even number of words, there are two middle words. In that case, the mean is defined to be the earlier (lexicographically smaller) of the two.

What is the mean of Ritisha's two favourite words?

Input

The first line contains a single integer, n (1 \leq n \leq 10^5), the length of Ritisha's two favourite words. These strings consist only of lowercase English letters.

The next line contains two strings s and t (|s| = |t| = n, s \ne t), Ritisha's favourite words.

Output

Output the mean word of s and t.

Example

Input 1
3
aba abe
Output 1
abc

See above for this example.

Input 2
5
worda wordh
Output 2
wordd

There are two middle words in this segment (wordd and worde), so the lexicographically smaller one is chosen.

Input 3
3
tom leo
Output 3
pjn

s may be lexicographically smaller or larger than t. Recall that mean is computed over all strings in lexicographical order, not character-by-character independently.


Comments


  • 0
    The_goated  commented on May 23, 2026, 6:55 a.m.

    yo whats test case 6 i keep failing that