S = input() c_w_w =[] for i in range(len(S)): if S[i] == "c" and len(c_w_w) == 0: c_w_w.append(i) if S[i] == "w" and (len(c_w_w) == 1 or len(c_w_w) ==2): c_w_w.append(i) if len(c_w_w) == 3: print(c_w_w[2] - c_w_w[0] + 1) else: print(-1)