S = input() N = len(S) cnt = 0 for i in range(N - 2): if S[i] == "c" and S[i+1] == "c" and S[i+2] == "w": cnt += 1 if cnt == 0: print(0) exit() ans = 10 ** 18 c = 0 for i in range(N - 2): if S[i] == "c" and S[i+1] == "c" and S[i+2] == "w": c += 1 if c == cnt: ans = min(ans, i + 1) c = 0 for i in range(N - 1, 1, -1): if S[i] == "w" and S[i-1] == "c" and S[i-2] == "c": c += 1 if c == cnt: ans = min(ans, N - i) print(ans)