4.1 Dheeraj & Strings
(RankList for this Question)
Score: 30pts
Time Limit: 5.00 sec
Dheeraj has a sequence of N strings S1, S2, … SN of length L. Dheeraj will concatenate all of the strings in some order, to produce a long string. Among all strings that he can produce in this way, find the lexicographically smallest one. Here, a string s = s1s2s3s4…sn is lexicographically smaller than the other string t = t1t2t3t4…tn if and only if one of the following holds:


There exists an index i(1 <= i <= min(n,m)), such that sj = tj for all indices (j1<=j<i),& si < ti.

si = ti for all integers i(i <= i <= min(n,m)
and n < m.

Constraints
1 <= N <= 100
For each i, the length of Si equals L
For each i, Si consists of lowercase letters

Input Format
N L
S1
S2
.
.
SN

Output Format
Print the lexicographically smallest string that Dheeraj can produce.

Example 1
Input:
3 3
dxx
axx
cxx

Output:
axxcxxdxx

Explanation:
The following order should be used: axx, cxx, dxx.

Log In to solve the Question