Concatenate Strings (Contest)
Concatenate Strings easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Concatenate Strings easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement :
Given N Strings of length L each. Find the lexicographically smallest string that can be formed after concatenating all the strings in some order. Input The first line of input contains two integers N and L. The next N lines contains a single sting each of length L.
Constraints:- 1 <= N <= 10000 1 <= L <= 20
Note:- String will contain only lowercase english letters. Output Print the lexicographically smallest string after concatenating all the strings in some order. Example Sample Input:- 3 6 newton school isbest
Sample Output:- isbestnewtonschool
Sample Input:- 4 1 b c a d
Sample Output:- abcd
link: