# coding=utf-8标签:子串,__,len,print,range,result,字符串,回文 From: https://www.cnblogs.com/wyl-520/p/17772452.html
# 找到s字符串中的回文子串
s = "abbc"
# n = len(s)
# result = ''
# for i in range(n):
# # print(i)
# for j in range(i, n):
# # print(j)
# k = s[i:j + 1]
# # print(k)
# # print(k[::-1])
# if k == k[::-1]:
# if len(k) > len(result):
# result = k
# print(result)
def lp():
n = len(s)
result = ''
for i in range(n):
for j in range(i, n):
k = s[i:j+1]
if k == k[::-1]:
if len(k) > len(result):
result = k
return result
if __name__ == '__main__':
print(lp())