my_str = input() out = 0 for i in range(len(my_str)): len_ABA = 1 k = i - 1 j = i + 1 while k >= 0 and j < len(my_str): if my_str[k] == my_str[j]: k -= 1 j += 1 len_ABA += 2 else: break len_ABBA = 0 k = i j = i + 1 while k >= 0 and j < len(my_str): if my_str[k] == my_str[j]: k -= 1 j += 1 len_ABBA += 2 else: break now_len = max(len_ABA,len_ABBA) if out < now_len: out = now_len print(out)