s = input() start_found = False w_first = False for i in range(len(s)): if s[i] == 'c': start = i start_found = True if s[i] == 'w': if start_found: w_first = True if w_first == True: end = i if end: print(end - start + 1) else: print(-1)