def solve(s,t): return sum(si==ti for si,ti in zip(s,t)) s = input() ans = 0 for i in range(len(s)): ans = max(ans,solve(s[i:],s[::-1])) ans = max(ans,solve(s,s[:i][::-1])) print(ans)