s = input() c_found = False w_count = 0 sum_count = 0 ans = [] for i in range(len(s)): if w_count == 2: break if s[i] == 'c': c_found = True if c_found: if s[i] == 'w' and w_count < 2: w_count += 1 sum_count += 1 if w_count == 2: print(sum_count) else: print(-1)