import re def main(): s = input() m = re.search(r"c.*?w.*?w", s) if (m == None): print(-1) else: print(len(m.group(0))) main()