t=gets.chars*?. p (0..1998).map{|l|c=1&~r=l t[l-=1]==t[r]&&c+=~l%2*2while t[r+=1] c}.max