public final class Main {
     public static void main(String[] args) {
          String input = "FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth";
          String match = "";
          
          StringBuilder stringBuilder = new StringBuilder();
          
          for(int i = 0, j = 0; i < input.length() || j < input.length(); i += j + 1 == input.length() ? 1 : 0, j = j + 1 == input.length() ? i : j + 1) {
               String string1 = input.substring(i, j);
               
               stringBuilder.delete(0, stringBuilder.length());
               stringBuilder.append(string1);
               stringBuilder.reverse();
               
               String string2 = stringBuilder.toString();
               
               if(string1.equals(string2) && string1.length() > match.length()) {
                    match = string1;
               }
          }
          
          System.out.println("The match is \"" + match + "\".");
     }
}