def func(x):
    for i in range(len(x),0,-1):
        for j in range(len(x)-i+1):
            if i % 2 == 0 and x[j:int(j+i/2)][::-1]==x[int(j+i/2):j+i]:
                return i
            if i % 2 != 0 and x[j:int(j+(i-1)/2)][::-1]==x[int(j+(i-1)/2+1):j+i]:
                return i

a = input()
b = func(a)
print(b)