N=list(map(int,input())) n=len(N) def solve(i,p): global a,A if p==1: for j in range(i+1,n): if v[j]==0 and N[j]!=N[i]: v[j]=1 solve(j,2) if p==2: for j in range(i+1,n): if v[j]==0 and N[j]==N[i]: v[j]=1 solve(j,3) if p==3: a+=1 A=max(A,a) for j in range(n): if v[j]==0: v[j]=1 solve(j,1) a-=1 return a=0 A=0 v=[0]*n v[0]=1 for i in range(n): if N[i]!=0: solve(i,1) print(A)