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