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