#include #include #include using namespace std; using ll = long long; string s; ll cnt[100010]; // 自分より右にあるwの数 int main() { cin >> s; int n = (int)s.size(); for (int i = 0; i < n; ++i) { if (s[i] == 'w') ++cnt[i]; } for (int i = n; i > 0; --i) cnt[i - 1] += cnt[i]; ll ans = 0; for (int i = 0; i < n; ++i) { if (s[i] == 'c') { ans += cnt[i] * (cnt[i] - 1) / 2; } } cout << ans << endl; return 0; }