S=input() min=101 if S.count("c")<1 or S.count("w")<2: print(-1) else: for (i,x) in enumerate(S): if x=="c": count=0 l=1 for y in S[i+1:]: l+=1 if y=="w": count+=1 if count==2: break if count==2: if l