input_line = input() if "c" in input_line: find_c = input_line.find("c") if "w" in input_line[find_c+1:]: find_w = input_line[find_c+1:].find("w") if "w" in input_line[find_c+find_w+2:]: find_ww = input_line[find_c+find_w+2:].find("w") print(find_ww+find_w+3) else: print(-1) else: print(-1) else: print(-1)