import java.util.*; public class Main{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); System.out.println(fun(s)); } private static String fun(String s){ int len = s.length(); char[] c = new char[2*len+2]; c[0]='$'; c[1]='#'; int index = 2; for(int i=0;i<len;i++){ c[index++]=s.charAt(i); c[index++]='#'; } len = 2*len+2; int maxmid = 0; int maxright = 0; int curmid = 0; int curlength = 0; int[] dp = new int[len]; for(int i=1;i<len;i++){ dp[i]=i<maxright?Math.min(maxright-i,dp[2*maxmid-i]):1; while(i+dp[i]<len && i-dp[i]>=0 && c[i+dp[i]]==c[i-dp[i]]){ dp[i]++; } if(maxright<i+dp[i]){ maxright=i+dp[i]; maxmid=i; } if(curlength<dp[i]){ curlength=dp[i]; curmid=i; } } return s.substring((curmid-curlength)/2,(curmid-curlength)/2+curlength-1); } }