# codidng=utf-8: s = str(input()) chiwawa = list() for string in s: chiwawa.append(string) c = 0 w1 = 0 w2 = 0 if len(chiwawa) < 3: print(-1) else: del chiwawa[:chiwawa.index("c")] for ch1 in chiwawa: if ch1 == "c": c = chiwawa.index(ch1) del chiwawa[:c] break for ch2 in chiwawa: if ch2 == "w": w1 = chiwawa.index(ch2) del chiwawa[:w1] break for ch3 in chiwawa: if ch3 == "w": w2 = chiwawa.index(ch3) del chiwawa[:w2] break ans = c + w1 + w2 + 1 print(ans)