r=range(99) while 1:a=raw_input();print max([a[i:j]*(a[i:j]==a[i:j][::-1])for i in r for j in r],key=len)