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