fork download
  1. def is_palindrom(x):
  2. return x==x[::-1]
  3. s=input ()
  4. n=len(s)
  5. for l in range(n, 0, -1):
  6. for p in range(0,n-l+1):
  7. if is_palindrom(s[p:p+l]):
  8. print (s[p:p+l])
  9. exit()
Success #stdin #stdout 0.01s 28384KB
stdin
ThesampletextthatcouldbereadedthesameinbothordersArozaupalanalapuazorA
stdout
ArozaupalanalapuazorA