By All Means
As Adelaide's best linguist, Ritisha knows every word. Although she tries to love them all equally, there are two words of length that are her favourite,
and
.
One Sunday afternoon, Ritisha was thinking about and
. 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
, the mean of the two words, could help her do this.
Consider the sorted list of all strings of length
in lexicographical order.
The mean of two words
and
is the middle word in the contiguous segment of this list whose endpoints are
and
(inclusive).
Equivalently, the mean is a word
such that there are equally many words before and after
within this segment, or there is one more word after than before.
For example, the mean of
abaandabeisabc, since the relevant portion of the sorted list is:
...,aba,abb,abc,abd,abe,...and
abcis equidistant fromabaandabe.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,
, the length of Ritisha's two favourite words. These strings consist only of lowercase English letters.
The next line contains two strings and
,
, Ritisha's favourite words.
Output
Output the mean word of and
.
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
may be lexicographically smaller or larger than
. Recall that mean is computed over all strings in lexicographical order, not character-by-character independently.
Comments
yo whats test case 6 i keep failing that