def main(): S = input() C = S.find('c', 0, ) cww = S.find('cww') if cww == -1: if C >= 0: W1 = S.find('w', C + 1) if W1 > C: W2 = S.find('w', W1 + 1,) if W2 < 0: print(-1) return elif C >= 0 and W1 - C > 0: print(W2 - C + 1) else: print(-1) if __name__ == '__main__': main()