def solve(): s = input()[::-1] wc = 0 res = 0 for c in s: if c == "c": if wc >= 2: res += (wc * (wc-1)) // 2 continue if c == "w": wc += 1 print(res) if __name__=="__main__": solve()