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