- 中心拓展法来求解,O(n^2)
string = input() # 中心拓展法 def expand(s, i, j): ans = 0 while i >=0 and j < len(s) and s[i] == s[j]: ans = j - i + 1 i = i - 1 j = j + 1 return ans ans = 0 for i in range(len(string)): ans = max(ans, expand(string, i, i)) ans = max(ans, expand(string, i, i+1)) print(ans