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 c != 0 and w != 0 and cww == "cww": print(w - c + 1) else: print(-1)