题解 | #密码截取#
密码截取
https://www.nowcoder.com/practice/3cd4621963e8454594f00199f4536bb1
while True: try: s = input() length = len(s) max_len = 1 for i in range(length - 1): for j in range(length, i + max_len, -1): if s[i] ==s[j-1] and s[i+1:j-1]==s[j-2:i:-1]: max_len = len(s[i:j]) break print(max_len) except: break