@@ -0,0 +1,940 @@
+// https://community.topcoder.com/stat?c=problem_statement&pm=12940%0A%0Apublic class MiddleCode %7B%0A%09public static String encode(String s) %7B%0A%09%09StringBuilder copyOfS = new StringBuilder(s);%0A%09%09StringBuilder t = new StringBuilder();%0A%09%09%0A%09%09while (true) %7B%0A%09%09%09int lengthOfS = copyOfS.length();%0A%09%09%09if (lengthOfS %25 2 == 1) %7B%0A%09%09%09%09char middleChar = copyOfS.charAt(lengthOfS / 2);%0A%09%09%09%09t.append(middleChar);%0A%09%09%09%09copyOfS.deleteCharAt(lengthOfS / 2);%0A%09%09%09%09if (copyOfS.length() == 0) %7B%0A%09%09%09%09%09break;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%09else %7B%0A%09%09%09%09char firstMiddleChar = copyOfS.charAt(lengthOfS / 2);%0A%09%09%09%09char secondMiddleChar = copyOfS.charAt((lengthOfS / 2) - 1);%0A%09%09%09%09char minChar = (char) Math.min(firstMiddleChar, secondMiddleChar);%0A%09%09%09%09t.append(minChar);%0A%09%09%09%09int minCharIndex = (minChar == firstMiddleChar) ? (lengthOfS / 2) : ((lengthOfS / 2) - 1);%0A%09%09%09%09copyOfS.deleteCharAt(minCharIndex);%0A%09%09%09%09if (copyOfS.length() == 0) %7B%0A%09%09%09%09%09break;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09return t.toString();%0A%09%7D%0A%7D%0A

Create MiddleCode.java