题解 | #最长回文子串#
最长回文子串
https://www.nowcoder.com/practice/12e081cd10ee4794a2bd70c7d68f5507
str1 = input()
n = 0
for i in range(len(str1)+1):
    for j in range(len(str1)+1):
        try:
            if str1[i:j] == str1[i:j][::-1]:
                if len(str1[i:j]) > n:
                    n = len(str1[i:j])
        except:
            continue
print(n)

 查看23道真题和解析
查看23道真题和解析 投递用友等公司10个岗位
投递用友等公司10个岗位