from bisect import bisect_right S = input().strip() C = [] W = [] for i in range(len(S)): if S[i]=="c": C.append(i) if S[i]=="w": W.append(i) n = len(W) ans = 0 for i in C: ind = bisect_right(W,i) m = n-ind ans += (m*(m-1))//2 print(ans)