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