public static void main(String[] args) { while (true) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); Scanner sc2 = new Scanner(System.in); List<String> list=new ArrayList<>(n); while(sc2.hasNext()){ list.add(sc2.next()); if(list.size()>n-1)break; } Collections.sort(list); Collections.reverse(list); String val=""; for (String s : list) { val+=s; } System.out.println(val); } }