/* ID: jennife2 LANG: JAVA TASK: calfflac */ import java.io.*; public class calfflac{ public static int ops = 0; public static void main(String[] args) throws IOException{ BufferedReader console = new BufferedReader(new FileReader("calfflac.in")); BufferedWriter out = new BufferedWriter(new PrintWriter(new FileWriter("calfflac.out"))); String s = ""; // string to be handled String read = ""; while(console.ready()){ ops++; String newline = console.readLine(); read+="\n"+newline; for(int i=0;i96&&(int)newline.charAt(i)<123||(int)newline.charAt(i)>64&&(int)newline.charAt(i)<91){ s += newline.charAt(i); } } } s = s.toUpperCase(); String read2 = read.toUpperCase(); // input with all uppercase String pall = ""; int longest = 0; int posLong = 0; // start position of longest palindrome // odd length palindromes for(int i=0; i=0&&i+zlongest){ longest = z*2+1; posLong = i-z; pall = s.substring(i-z,i+z+1); } } // even length palindromes for(int i=0; i=0&&i+zlongest||z*2==longest&&i-z+10){ for(int i=0;curChar>-1&&i 0){ if ((int)read2.charAt(i)>64&&(int)read2.charAt(i)<91){ curChar = 0; i--; } } } System.out.println(ops); //System.out.println(start+","+end); //System.out.println(pall); System.out.print(longest+"\n"+read.substring(start,end)+"\n"); out.write(longest+"\n"+read.substring(start,end)+"\n"); } else{ out.write("0\n\n"); } out.close(); System.exit(0); } }