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