for(;r=readline();print(i))for(i=-1;+r;r=t,i++)for(t=a=j="";c=r[j++];)t+=+c+10*a>>1,a=c%2