题解 | #最长回文子串#
最长回文子串
https://www.nowcoder.com/practice/12e081cd10ee4794a2bd70c7d68f5507
#时间压迫下的很快能想到的方法,但是比较笨 s=str(input()) l=[] for i in range(len(s)): for j in range(len(s)): l.append(s[i:j+1]) x=[m for m in l if m is not ''] l2=[] for n in x: if n==n[::-1] and len(n)>1: l2.append(n) #print(len(max(l2))) l3=[] for t in l2: l3.append(len(t)) print(max(l3))