str = input() count = 0 cww = "" valid = False for s in str: count += 1 if s == 'c': cww = s count = 1 elif s == 'w': cww += s if cww == "cww": valid = True break if valid: print(count) else: print(-1)