题解 | #最长回文子串#

最长回文子串

https://www.nowcoder.com/practice/12e081cd10ee4794a2bd70c7d68f5507

ipt = input()
def len_longestsubpalin(s):
    for lensub in range(len(s), 0, -1):
        for i in range(0, len(s) - lensub +1):
            if s[i:i+lensub] == s[i:i+lensub][::-1]:
                return lensub

print(len_longestsubpalin(ipt))

全部评论

相关推荐

积木_积木:这 tm 不纯纯大作业吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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