题解 | 密码截取

密码截取

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))

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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