import sys dump = lambda *x : print(*x, file = sys.stderr) import re s = input() m = re.search(r'c.*w.*w.*?', s) dump(m) if m is None: print(-1) else: print(len(m.group(0)))