题解 | #最长回文子串#
最长回文子串
https://www.nowcoder.com/practice/12e081cd10ee4794a2bd70c7d68f5507
def len_max(a): i=0 max_len=1 while i<len(a): j=len(a)-1 while i<=j: if a[i]==a[j] and a[i:j+1]==''.join(list(reversed(a[i:j+1]))): max_len=max(max_len,j-i+1) break j-=1 i+=1 return max_len while True: try: s=input() max_len=len_max(s) print(max_len) except: break