s = input() l = [] count = 0 temp = '' max = 0 for i in range(len(s)): count = 0 temp = '' if s[i] == 'c': for j in range(i, len(s)): temp += s[j] if s[j] == 'w': count += 1 if count == 2: break l.append(temp) for i in l: if i.count('c') == 1 and i.count('w') == 2 and len(i) > max: max = len(i) if max: print(max) else: print(-1)