s = input() flag_c, flag_w = False, False start = 0 for i, v in enumerate(s): if v == "c" and flag_c == False: flag_c = True start = i if v == "w" and flag_c == True: if flag_w == False: flag_w = True elif flag_w == True: print(i - start + 1) break else: print(-1)