题解 | 密码截取
密码截取
https://www.nowcoder.com/practice/3cd4621963e8454594f00199f4536bb1
s = input()
l = []
for i in range(len(s)):
for j in reversed(range(i+1,len(s))):
if s[i]==s[j] and s[i+1:j]==s[i+1:j][::-1]:
l.append(len(s[i:j+1]))
print(max(l))
查看20道真题和解析