题解 | #最长回文子串#双指针
最长回文子串
http://www.nowcoder.com/practice/12e081cd10ee4794a2bd70c7d68f5507
def fun(str_input):
max_len = 0
for i in range(len(str_input)):
for j in range(len(str_input) - 1, i - 1, -1):
if str_input[i: j + 1][::-1] == str_input[i: j + 1]:
if j + 1 - i > max_len:
max_len = j + 1 - i
return max_len
while True:
try:
str_input = input()
print(fun(str_input))
except:
break