S = input() p = S.find('c') ans = -1 while p >= 0: S = S[p:] cnt = 0 for i in range(len(S)): if S[i] == 'w': cnt += 1 if cnt == 2: if ans == -1: ans = i + 1 else: ans = min(ans, i + 1) S = S[1:] p = S.find('c') print(ans)