s = input() cww = "" idx = [] for i, v in enumerate(s): if v == "c": cww += v idx.append(i) elif v == "w": cww += v idx.append(i) if len(cww) == 3 and cww == "cww": print(idx[2] - idx[0] + 1) else: print(-1)