#include using namespace std; using ll = long long; using ul = unsigned long; using ull = unsigned long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); string s; cin >> s; ll w{ 0 }, res{ 0 }; for (string::const_reverse_iterator it=s.crbegin(); it!=s.crend(); ++it) { if (*it == 'w') ++w; else if (*it == 'c' && w > 1) res += w * (w - 1) / 2; } cout << res << "\n"; return 0; }