268. Hyper Almost Permutative String

time limit per test: 0.25 sec.
memory limit per test: 65536 KB
input: standard
output: standard



The string is called permutative if it consists of N first capital letters in arbitrary order (i.e. "A", "BA", "CABED", "DCBA" for N=1, 2, 5, 4 correspondingly). The string is called almost permutative, if it is possible to obtain permutative string from it by removing exactly one symbol (i.e. "BA", "ABCCD", "BCAB", "ATB" -- almost permutative strings for N=1, 4, 3, 2 correspondingly). The string is called hyper almost permutative for some given N, if all its substrings of length N+1 are almost permutative (i.e. "ABCBACB", "ABCTABC", "CBACAB" -- hyper almost permutative strings for N=3).
Your task is to find the shortest hyper almost permutative string, containing permutative strings S1 and S2 as substrings for some given N. Strings S1 and S2 have the length N. The resulting string should be hyper almost permutative for the same given N.

Input
The first line of the input file contains the integer number N (2 <= N <= 26). The second line contains the permurtative string S1. The third line contains the permurtative string S2. You can assume that S1 and S2 are different.

Output
Write to the output file the answer for the problem. If there are several possible answers, output any of them.

Sample test(s)

Input
3
ABC
ACB

Output
ABCACB
[submit]
[forum]

Author:Andrew V. Lazarev
Resource:ACM ICPC 2004-2005, NEERC, Southern Subregional Contest
Date:Saratov, October 7, 2004











Server time: 2017-09-20 16:58:44Online Contester Team © 2002 - 2016. All rights reserved.