String Cards

AtCoder
IDabc225_f
Time2000ms
Memory256MB
Difficulty
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. ## Constraints * $1 \leq K \leq N \leq 50$ * $1 \leq |S_i| \leq 50$ * $S_i$ consists of lowercase English letters. ## Input Input is given from Standard Input in the following format: $N$ $K$ $S_1$ $S_2$ $\vdots$ $S_N$ [samples]
Samples
Input #1
4 3
ode
zaaa
r
atc
Output #1
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`.
Input #2
5 2
z
z
zzz
z
zzzzzz
Output #2
zz

There may be a pair $i, j$ $(i\neq j)$ such that $S_i = S_j$.
API Response (JSON)
{
  "problem": {
    "name": "String Cards",
    "description": {
      "content": "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",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc225_f"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "We have $N$ cards. The $i$\\-th card has a string $S_i$ written on it.\nFind the lexicographically smallest string that can be obtained by choosing $K$ of these cards and concatenating them in any order...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments