B - cat Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 200

問題文

英小文字からなる N 個の文字列 S_1, S_2, \ldots, S_N が与えられます。ここで、文字列の長さはそれぞれ相異なります。

これらの文字列を長さの昇順に並べ替え、この順に結合して得られる文字列を求めてください。

制約

  • 2 \leq N \leq 50
  • N は整数
  • S_i は長さ 1 以上 50 以下の英小文字からなる文字列
  • i \neq j のとき S_iS_j の長さは異なる

入力

入力は以下の形式で標準入力から与えられる。

N
S_1
S_2
\vdots
S_N

出力

答えを出力せよ。


入力例 1

3
tc
oder
a

出力例 1

atcoder

( tc, oder, a ) を文字列の長さの昇順に並べ替えると ( a, tc, oder ) となります。これらの文字列を順に結合すると文字列 atcoder が得られます。


入力例 2

4
cat
enate
on
c

出力例 2

concatenate

Score : 200 points

Problem Statement

You are given N strings S_1, S_2, \ldots, S_N, each consisting of lowercase English letters. The lengths of these strings are all distinct.

Sort these strings in ascending order of length, and then concatenate them in that order to form a single string.

Constraints

  • 2 \leq N \leq 50
  • N is an integer.
  • Each S_i is a string consisting of lowercase English letters with length between 1 and 50, inclusive.
  • If i \neq j, the length of S_i is different from the length of S_j.

Input

The input is given from Standard Input in the following format:

N
S_1
S_2
\vdots
S_N

Output

Print the answer.


Sample Input 1

3
tc
oder
a

Sample Output 1

atcoder

When we sort (tc, oder, a) in ascending order of length, we get (a, tc, oder). Concatenating them in this order yields the string atcoder.


Sample Input 2

4
cat
enate
on
c

Sample Output 2

concatenate