题解 | #密码截取#

密码截取

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

def find(string):
    res = ''
    for i in range(len(string)):
        start = max(i - len(res) -1, 0)
        temp = string[start: i+1]
        if temp == temp[::-1]:
            res = temp
        else:
            temp = temp[1:]
            if temp == temp[::-1]:
                res = temp
    return len(res)
    
string = input().strip()
print(find(string))

全部评论

相关推荐

03-28 16:43
佛山大学 Java
不知该咋办:简历2.0,各位佬看看,这样可以吗查看图片
点赞 评论 收藏
分享
程序员小白条:可以,技术栈别写太多,因为学院本这块,没必要太多,项目的话可以提前,技术栈放最下面,要么技术栈放最前面,多准备下八股文
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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