def count_chiwawa(str): count_flg = False count = 0 w_count = 0 for s in list(str): if s == "c": count_flg = True w_count = 0 count = 0 elif s == "w" and count_flg: w_count += 1 if count_flg: count += 1 if w_count == 2: return count return -1 print(count_chiwawa(input()))