S = [x for x in input() if x == "c" or x == "w"] limit = 100000 fact = [1] * (limit + 1) for i in range(2, limit + 1): fact[i] = fact[i - 1] * i def nCk(n, k): if k > n: return 0 return fact[n] // (fact[n - k] * fact[k]) ans = 0 w = 0 for s in S[::-1]: if s == "w": w += 1 else: ans += nCk(w, 2) print(ans)