S = input() f = 0 st = -1 for i, s in enumerate(S): if f == 0 and s == 'c': f += 1 st = i elif f == 1 and s == 'c': st = i elif f == 1 and s == 'w': f += 1 elif f == 2 and s == 'w': print(i - st + 1) break else: print(-1)