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 i=0 while i=0 and i+ja: a=c i +=1 if a==2 and len (S)==2: a=1 print(a)