import re S = input() r = re.search(r'c.*?w.*?w',S) if r is None: print(-1) else: print(len(r.group()))