M = input() c = M.find("c") index = [i for i, x in enumerate(M) if x == "w"] if c < index[0]: ans = index[1] + 1 - c print(ans) else: print(-1)