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