/* 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 = ""; int[] st = new int[20000]; int stc = 0; int counter = 0; while(console.ready()){ String newline = console.readLine(); read+=newline+"\n"; for(int i=0;i96&&(int)newline.charAt(i)<123||(int)newline.charAt(i)>64&&(int)newline.charAt(i)<91){ s += newline.charAt(i); st[stc] = counter; //System.out.println(newline.charAt(i)+","+counter+" "); stc++; } counter++; } counter++; } //System.out.print(s); s = s.toUpperCase(); int longest = 0; int posLong = 0; // start position of longest palindrome int z = 1; // odd length palindromes for(int i=0; i=0&&i+zlongest){ longest = (z-1)*2+1; posLong = i-(z-1); } } // even length palindromes for(int i=0; i=0&&i+zlongest||(z-1)*2==longest&&i-(z-1)+10){ out.write(longest+"\n"+read.substring(st[posLong],st[posLong+longest-1]+1)+"\n"); } else{ out.write("0\n\n"); } out.close(); System.exit(0); } }