#include #include #include #include using namespace std; int main() { string s; cin >> s; vector c, w; int ans = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == 'c') c.push_back(i); else if (s[i] == 'w') w.push_back(i); } for (int i = 0; i < c.size(); i++) { auto it = lower_bound(w.begin(), w.end(), c[i]); int count = distance(it, w.end()); ans += count * (count -1) / 2; } cout << ans << endl; return 0; }