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