t=p=0 for r in raw_input():n=int(oct(2<<6155848/ord(r)%11));t+=n/2-p%n;p=n print t