S = input() w_1_idx = S.find("w") c_idx = S.rfind("c", w_1_idx) w_2_idx = S.find("w", w_1_idx+1) if c_idx != -1 and w_1_idx != -1 and w_2_idx != -1: print(w_2_idx-c_idx+1) else : print(-1)