#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 sum(n); for (int i = 0; i < n; ++i) { if (s[i] == 'w') { sum[i]++; } } for (int i = n - 2; i >= 0; --i) { sum[i] += sum[i + 1]; } ll ans = 0; for (int i = 0; i < n; ++i) { if (s[i] == 'c') { ans += sum[i] * (sum[i] - 1) / 2; } } cout << ans << endl; return 0; }