题解 | #密码截取#

密码截取

https://www.nowcoder.com/practice/3cd4621963e8454594f00199f4536bb1

s = input()
l = []
res = []
n = len(s)
for i in range(n-1):
    for j in range(1,n):
        if s[i] == s[j] and s[i:j+1] == s[i:j+1][::-1]:
            l.append(len(s[i:j+1]))

print(max(l))

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务