# 方法1:中心外扩,遍历s的每个字符,以当前字符作为中心 def fun(s: str, begin: int, end: int): while begin >= 0 and end < len(s) and s[begin] == s[end]: begin -= 1 end += 1 return end - begin - 1 while True: try: s = input() maxlen = 1 for i in range(len(s) - 1): ...