while 1:i=t=0;s=raw_input()+'='*9;exec"t+=1;i+=ord(s[i])%3*t-t;"*9;print 1/i+1