#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define MOD 1000000007 int main() { string s; cin >> s; int n = s.size(); vector w(n); for (int i = n - 1; i >= 0; --i) { w[i] = (s[i] == 'w'); if (i != n - 1) w[i] += w[i + 1]; } ll ans = 0; for (int i = 0; i < n; ++i) { if (s[i] == 'c') ans += w[i] * (w[i] - 1) / 2; } cout << ans << endl; return 0; }