#!/usr/bin/env python3 # -*- coding: utf-8 -*- import itertools def mykey(c): if c not in "cw": return "*" else: return c def solve(s): answer = 0 c_nums = [] w_nums = [] for k, g in itertools.groupby(s, mykey): if k == "c": c_nums.append(len("".join(g))) elif k == "w": if not c_nums: continue w_nums.append(len("".join(g))) for i, x in enumerate(c_nums): w = sum(w_nums[i:]) answer += x * w * (w - 1) // 2 return answer if __name__ == '__main__': print(solve(input()))