def solve(S): w = 0 count = 0 for s in S[::-1]: if s == 'w': w += 1 elif s == 'c': count += w * (w - 1) // 2 return count S = input() print(solve(S))