β Concatenate Strings (Contest)
Concatenate Strings easy Time Limit: 2 sec Memory Limit: 128000 kB
import java.io.*; // for handling input/output
import java.util.*; // contains Collections framework
// don't change the name of this class
// you can add inner classes if needed
class Main {
public static void main (String[] args) {
// Your code here
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int l = sc.nextInt();
sc.nextLine();
String [] str = new String[n];
for(int i =0;i<n;i++){
str[i] = sc.next();
}
Arrays.sort(str);
StringBuilder res = new StringBuilder();
for(String s : str){
res.append(s);
}
System.out.println(res);
}
}Last updated