s=input() p=0 q=set() w="" for i in "cww": p=s.find(i,p) if p<0:break q.add(p) w+=s[p] p+=1 print(max(q)-min(q)+1 if w=='cww' else -1)