@@ -0,0 +1,639 @@
+class Main %7B%0A    public static void main(String%5B%5Da)throws Exception %7B%0A        byte%5B%5Db=new byte%5B20000%5D;System.in.read(b);%0A        String%5B%5Dw=new String(b).split(%22%5C%5Cs%22);%0A        StringBuilder x=new StringBuilder(9000),c=new StringBuilder();%0A        int n=Integer.parseInt(w%5B0%5D),i,j;%0A        java.util.Arrays.sort(w,1,n+1);%0A        for(i=1;i%3C=n;i++)%7B%0A            String v=w%5Bi%5D,r=new StringBuilder(v).reverse().toString();%0A            for(j=i+1;j%3C=n&&!r.equals(w%5Bj%5D);j++);%0A            if(j%3C=n)%7Bx.append(v);w%5Bj%5D=%22%22;%7Delse if(r.equals(v))c.append(r);%0A        %7D%0A        System.out.print(x);%0A        System.out.print(c.append(x.reverse()));%0A    %7D%0A%7D%0A

Create test1.java