S = input() lens = len(S) for i,c in enumerate(S): chiwawa = False if c == "c": start = i wcnt = 0 length = 1 if i + 2 <= lens: for j,c2 in enumerate(S[i + 1:]): length+=1 if c2 == "w": wcnt+=1 if wcnt == 2: chiwawa = True break if chiwawa: break else: length = -1 print(length)