S = [x for x in input() if x == "c" or x == "w"] ans = 0 w = 0 for s in S[::-1]: if s == "w": w += 1 else: ans += (w * (w - 1)) // 2 print(ans)