s = input() n = len(s) ans = n for i in range(n): if s[i] =='w': ans = min(ans, i - 1) break for i in range(n - 1, -1, -1): if s[i] == 'c': ans = min(ans, n - i - 1) break print(ans)