import re def solve(): S = input() p = re.compile('.*(c[^c]*?w.*?w).*') m = p.search(S) if m: print(len(m.group(1))) else: print(-1) if __name__ == '__main__': solve()