import re S = input() x = re.findall(r'(c.*?w.*?w)', S) if x: print(len(x[0])) else: print(-1)