S = list(input()) N = len(S) inf = 10 ** 18 dp = [inf] * (N + 1) for i in range(1, N + 1): L = [] val = 0 for j in range(i): L.append(S[i - j - 1]) if L == L[::-1]: val = max(val, min(dp[i - j - 1], j + 1)) dp[i] = val print(dp[-1])