题解 | #密码截取#
密码截取
https://www.nowcoder.com/practice/3cd4621963e8454594f00199f4536bb1
import sys while 1: try: date=input() n=len(date) l=[] for i in range(n-1): for x in range(n-1,0,-1): if date[i]==date[x]: if date[i:x+1]==date[i:x+1][::-1]: l.append(len(date[i:x+1])) else: continue else: continue print(sorted(l,reverse=True)[0]) except: break