while 1: s=raw_input();l=v=len(s) while l: for o in range(v-l+1): p=s[o:o+l] if p[::-1]==p:print p;l=1;break l-=1