inputed_list = list(input()) res = 1 tmp_list = [] for i in range(len(inputed_list)): tmp_list.clear() for e in inputed_list: tmp_list.append(e) j = 1 length = 1 while True: if i - j < 0 or i + j >= len(inputed_list): break b = tmp_list[i - j] f = tmp_list[i + j] if b == f: length += 1 res = max(res, length) j += 1 else: tmp_list[i - j] = ' ' tmp_list[i + j] = ' ' j += 1 if res == 1: print(0) elif res % 2 == 1: print(res * 2 - 1) else: print(res * 2)