def main(): inp = input() num = [] count = 0 ans = 1 length = len(inp) check = 0 for i in inp: wid = ans while length - count >= wid: if wid % 2 == 0: if inp[count : count + wid // 2] == inp[count + wid -1 : count + wid //2 - 1 : -1]: ans = wid wid += 1 check += 1 else: wid += 1 else: if inp[count : count + wid // 2 ] == inp[count + wid - 1 : count + wid // 2 : -1]: ans = wid wid += 1 check += 1 else: wid += 1 count += 1 if check >= 2: ans = 1 print(ans) if __name__ == '__main__': main()