import re s = input() p = re.search(r"c.*w+.*w", s) if p: print(len(p.group())) else: print(-1)