#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) #define ALL(v) (v).begin(), (v).end() 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 = index_w.end() - upper_bound(ALL(index_w), i); ans += cnt * (cnt - 1) / 2; } cout << ans << endl; return 0; }