s = input().strip() n = len(s) count_w = [0] * n current = 0 # Precompute the number of 'w's to the right of each position for i in reversed(range(n)): count_w[i] = current if s[i] == 'w': current += 1 ans = 0 # Calculate the number of valid "cww" subsequences for i in range(n): if s[i] == 'c': k = count_w[i] ans += k * (k - 1) // 2 print(ans)