#include using namespace std; using ll = long long; using vi = vector; using vb = vector; using vd = vector; using vl = vector; using vvi = vector; using vvb = vector; using vvd = vector; using vvl = vector; #define REP(i,n) for(ll i=0; i<(n); ++i) #define FOR(i,b,n) for(ll i=(b); i<(n); ++i) int main() { string s; cin >> s; vl index_c; vl index_w; REP(i, s.size()) { if (s[i] == 'c') index_c.push_back(i); if (s[i] == 'w') index_w.push_back(i); } ll ans = 0; for (ll i : index_c) { ll cnt = 0; for (ll j : index_w) if (j > i) ++cnt; ans += cnt * (cnt - 1) / 2; } cout << ans << endl; return 0; }