#arc058d. [arc058_d]Iroha Loves Strings
[arc058_d]Iroha Loves Strings
Problem Statement
Iroha has a sequence of strings .
She will choose some (possibly all) strings from the sequence, then concatenate those strings retaining the relative order, to produce a long string.
Among all strings of length that she can produce in this way, find the lexicographically smallest one.
Constraints
- For each , .
- For each , consists of lowercase letters.
- There exists at least one string of length that Iroha can produce.
Input
The input is given from Standard Input in the following format:
:
Output
Print the lexicographically smallest string of length that Iroha can produce.
Sample Input 1
3 7
at
coder
codar
Sample Output 1
atcodar
at
and codar
should be chosen.
Sample Input 2
3 7
coder
codar
at
Sample Output 2
codarat
codar
and at
should be chosen.
Sample Input 3
4 13
kyuri
namida
zzzzzzz
aaaaaa
Sample Output 3
namidazzzzzzz
namida
and zzzzzzz
should be chosen.