def long_lca(str1):
max_len, result = float("-inf"), ""
for i in range(len(str1)):
for j in range(i+1, len(str1)):
if str1[i:j] == str1[i:j][::-1]:
if j-i > max_len:
max_len = j-i
result = str1[i:j]
return result
def main():
str = input("请输入字符串:")
print("最长回文子串为:", long_lca(str))
if __name__ == "__main__":
main()