S=input() a=0 i=0 while i < len(S)-2: if S[i]==S[i+2]: j=1 c=3 while i-j>=0 and i+ja: a=c i+=1 while i=0 and i+ja: a=c i +=1 print(a)