import sys def helper(s, l, r): while l >= 0 and r < len(s) and s[l] == s[r]: l -= 1 r += 1 return s[l+1:r] def get_longest(s): res = "" for i in range(len(s)): #先判定奇数的,从i开始左右对比 temp = helper(s, i, i) if len(temp) > len(res):res = temp #再判定偶数的,从i和i+1开始对比 temp = helper(s, i, i + 1) if len(temp) > len(res):res = temp return len(res) while True: try: s = input().strip() print(get_longest(s)) except: # print(sys.exc_info()) break