题解 | #密码截取#
密码截取
https://www.nowcoder.com/practice/3cd4621963e8454594f00199f4536bb1
s = input() p = 0 for i in range(len(s)): for j in range(len(s)-1,i+1,-1): if s[i] == s[j] and s[i+1:j] == s[j-1:i:-1] and j-i+1 > p: p = j-i+1 print(p)
密码截取
https://www.nowcoder.com/practice/3cd4621963e8454594f00199f4536bb1
s = input() p = 0 for i in range(len(s)): for j in range(len(s)-1,i+1,-1): if s[i] == s[j] and s[i+1:j] == s[j-1:i:-1] and j-i+1 > p: p = j-i+1 print(p)
相关推荐