#暴解
def huiwen(lists,left,right): while left < right : if lists[left] != lists[right]: return False left += 1 right -= 1 return True maxlen = 1 begin =0 n = list(input()) for i in range(0,len(n)-1): for j in range(i+1,len(n)): if j - i + 1 > maxlen and huiwen(n, i, j): maxlen = j - i + 1#回文长度 begin = i#回文开始坐标 print(len(n[begin:begin+maxlen]))