S = input()[::-1] ans = Nw = 0 for s in S: if s == 'w': Nw += 1 if s == 'c': ans += Nw*(Nw-1)//2 print(ans)