from bisect import * S = input() cpos = [] wpos = [] for i, s in enumerate(S): if s == "c": cpos.append(i) if s == "w": wpos.append(i) nw = len(wpos) ans = 0 for c in cpos: x = nw - bisect_left(wpos, c) ans += x * (x - 1) // 2 print(ans)