a=input() b=0 if "c" in a: f=a.index("c") for i,j in enumerate(a): if (j=="w") and (f!=-1): b+=i if b!=i: print(i-f+1) break else: print("-1")