s = input() c, w, cnt = 0, 0, 0 cww = "" for i, v in enumerate(s): if v == "c": c = i + 1 cww += v elif v == "w": cnt += 1 cww += v if cnt == 2: w = i + 1 break if len(cww) == 3 and cww == "cww" and c != 0 and w != 0: print(w - c + 1) else: print(-1)