S = list(input()) l = len(S) -1 def solve(i,j): global S count = 0 while i <= j: #print("i:",i,"j:",j) if S[i] == S[j]: if i == j: count += 1 else: count += 2 i += 1 j -= 1 return count prev_count = 0 for i in range(l): for j in range(i+1): if prev_count >= l - i: print(prev_count) exit(0) count = solve(i+j,l-j) #print("count:",count) if prev_count < count: prev_count = count print(prev_count)