s = input() cww = "cww" idxlist = [0] for c in cww: idx = s.find(c) if idx == -1: print(-1) exit(0) idxlist.append(idx + idxlist[-1]) s = s[idx:] print(idxlist[-1] - idxlist[1])