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