import re s = input() a = re.search('c[^cw]*?w.*?w', s) if a == None: print(-1) else: print(len(s[a.start():a.end()]))