S = input() first_c = S.find("c") first_w = S.find("w") second_w = (S[(first_w + 1):].find("w")) + first_w + 1 if (first_c >= 0) and (first_w >= 0) and (second_w >= 0) and (first_c < first_w): print(second_w - first_c + 1) else: print(-1)