import java.io.*;import java.util.*;class Main{static BufferedReader i=new BufferedReader(new InputStreamReader(System.in));static String x,y;static int d;static Object[]w;static StringBuilder b=new StringBuilder(),c=new StringBuilder();static HashMap<String,String>h=new HashMap<>();public static void main(String[]a)throws Exception{i.readLine();while((x=i.readLine())!=null){y=b.replace(0,x.length(),x).reverse().toString();d=x.compareTo(y);if(d==0)c.append(x);else if(h.containsKey(x))h.put(x,d<0?x:y);else h.put(y,"");}w=h.values().toArray();Arrays.sort(w);b.delete(0,b.length());for(Object z:w)b.append(z);System.out.print(b);System.out.print(c);System.out.print(b.reverse());}}

import java.io.*;import java.util.*;class Main{public static void main(String[]a)throws Exception{BufferedReader i=new BufferedReader(new InputStreamReader(System.in));String x,y; int d; Object[]w; StringBuilder b=new StringBuilder(),c=new StringBuilder();Map h=new HashMap();i.readLine();while((x=i.readLine())!=null){y=b.replace(0,x.length(),x).reverse().toString();d=x.compareTo(y);if(d==0)c.append(x);else if(h.containsKey(x))h.put(x,d<0?x:y);else h.put(y,"");}w=h.values().toArray();Arrays.sort(w);b.delete(0,b.length());for(Object z:w)b.append(z);System.out.print(b);System.out.print(c);System.out.print(b.reverse());}}

Update test5.java