题解 | #最长回文子串#
最长回文子串
https://www.nowcoder.com/practice/12e081cd10ee4794a2bd70c7d68f5507
ipt = input()
def len_longestsubpalin(s):
#search from the longest sub str(itself) to a single char
for lensub in range(len(s), 0, -1):
# i is the location of this sub str
for i in range(0, len(s) - lensub +1):
# the first returned val must be the longest sub palindrome str
if s[i:i+lensub] == s[i:i+lensub][::-1]:
return lensub
print(len_longestsubpalin(ipt))