def is_palindrom(x): return x==x[::-1] s=input () n=len(s)for l in range(n, 0, -1): for p in range(0,n-l+1): if is_palindrom(s[p:p+l]): print (s[p:p+l]) exit()
ThesampletextthatcouldbereadedthesameinbothordersArozaupalanalapuazorA
ArozaupalanalapuazorA
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!