s = input() x = 0 for i in range(len(s)): for j in range(i+1, len(s)+1): l1 = s[i:j] l2 = l1[::-1] if l1 == l2 and len(l1) != len(s): x = max(x, len(l1)) print(x)