#include #include #include #include #include #include #include #include #include #include #include #include #define mod 1000000007; using namespace std; typedef long long ll; typedef pair Pr; string s; ll C[10010][10010]; void comb_table(int N) { for (int i = 0; i <= N; i++) { for (int j = 0; j <= i; j++) { if (j == 0 || j == i) { C[i][j] = 1LL; } else { C[i][j] = C[i - 1][j - 1] + C[i - 1][j]; } } } } int main() { cin >> s; comb_table(s.size()); int w = 0; ll ans = 0; for (int i = s.size() - 1; i >= 0; i--) { if (s[i] == 'w')w++; if (s[i] == 'c' && w >= 2) { ans += C[w][2]; } } cout << ans << endl; return 0; }