while 1: t=i,s=0,raw_input();L=l=len(s) while t!=t[::-1]:t=s[i:i+l];b=i>=L-l;i+=1-b-i*b;l-=b print t