Score : $500$ points
We have $N$ cards. The $i$-th card has a string $S_i$ written on it.
Find the lexicographically smallest string that can be obtained by choosing $K$ of these cards and concatenating them in any order.
Input is given from Standard Input in the following format:
$N$ $K$ $S_1$ $S_2$ $\vdots$ $S_N$
Print the answer.
4 3 ode zaaa r atc
atcoder
Note that it is not possible to reverse or permute the string written on a card.
For example, ode
written on the first card cannot be used as edo
or deo
.
5 2 z z zzz z zzzzzz
zz
There may be a pair $i, j$ $(i\neq j)$ such that $S_i = S_j$.