fork download
  1. import java.util.Arrays;
  2. import java.io.*;
  3. public class Main {
  4. public static void main (String[]args)throws Exception{
  5.  
  6. int cases = Integer.parseInt(read.readLine());
  7.  
  8. int words;
  9. String string="";
  10. String[] string2;
  11. String[] []A = new String [0][];
  12.  
  13. for(int i=0;i<cases;i++){
  14. words = Integer.parseInt(read.readLine());
  15. for(int c=0;c<words;c++){
  16. string = read.readLine() + " " + string;
  17. }
  18. string2 = string.split(" ");
  19. Arrays.sort(string2);
  20. for(int c=0;c<words;c++){
  21. System.out.println(string2[c]);
  22. }
  23. string ="";
  24.  
  25. }
  26.  
  27. }
  28. }
Success #stdin #stdout 0.09s 213440KB
stdin
3
2
helloworld
worldhello
2
aaaaaaaaaa
Aaaaaaaaaa
5
alsdkdjfh
sdfsaaa
AHDHASD
kjashdajskh
alksjdsd
stdout
helloworld
worldhello
Aaaaaaaaaa
aaaaaaaaaa
AHDHASD
alksjdsd
alsdkdjfh
kjashdajskh
sdfsaaa