def chara_match(instr): instr_rev = instr[::-1] s = 0 for i in range(len(instr)): if instr_rev[i] == instr[i]: s += 1 return s s = input() n = len(s) ans = 0 for i in range(n): ans = max(ans, chara_match(s[0:i+1])) for i in range(n): ans = max(ans, chara_match(s[i:n])) print(ans)