题目描述
Problem Description
Given two strings $s$ and $t$ consisting of lowercase English letters, and an integer $L$, consider generating a string of length $L$ by arranging $s$ and $t$ in any order, using each string one or more times. You can use the same string multiple times.
For example, when $s =$ at, $t =$ code, and $L = 6$, you can generate strings like atatat, atcode, and codeat.
Among the strings of length $L$ generated in this way, find the lexicographically smallest one. Note that in the given cases, it is always possible to generate a string of length $L$.
Input Format
The input is given from the standard input in the following format:
$L$ $s$ $t$
Output Format
Output the lexicographically smallest string of length $L$ that can be generated as described in the problem statement.
Sample Input and Output
Sample Input #1
6
at
code
Sample Output #1
atatat
Sample Input #2
8
coding
festival
Sample Output #2
festival
Sample Input #3
8
same
same
Sample Output #3
samesame
Sample Input #4
10
coin
age
Sample Output #4
ageagecoin
Notes/Hints
Constraints
- $1 \leq L \leq 2 \times 10^5$
- $1 \leq |s|, |t| \leq L$
- $s$ and $t$ consist of lowercase English letters.
- It is possible to generate a string of length $L$ from $s$ and $t$ as described in the problem statement.
Sample Explanation 1
This input corresponds to the example given in the problem statement.
Sample Explanation 2
One of the strings $s$ or $t$ might be completely useless in generating a string of length $L$.
Sample Explanation 3
It is possible that $s = t$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分