import java.util.*;class Main{public static void main(String[]g)throws Exception{byte[]u=new byte[32767];String x,y;Object[]w;StringBuilder b=new StringBuilder(),c=new StringBuilder();Map h=new HashMap();int d,n;g=new String(u,0,System.in.read(u)).split("\n");for(n=1;n<g.length;n++){x=g[n];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());}}

@@ -108,16 +108,21 @@
 ring x,y
+,c=%22%22
 ;Object%5B
@@ -148,30 +148,8 @@
 new 
-StringBuilder(),c=new 
 Stri
@@ -346,18 +346,11 @@
 =0)c
-.append(x)
++=x
 ;els
@@ -512,35 +512,17 @@
 .print(b
-);System.out.print(
++
 c);Syste

Update test5.java