#include #include using namespace std; int main() { string s, ss; //int i = 0, j = 0, n, a = 0, ll = 0; long long int i = 0, j = 0, n, a = 0, ll = 0, l = 0; cin >> s; l = s.length(); for (i = 0; i < l; i++) { if (s[i] == 'c') { ss += 'c'; } else if (s[i] == 'w') { ss += 'w'; } } ss += '\0'; ll = ss.length(); i = 0; j = 0; while (-1) { if (ss[i] == 'c') { n = 0; for (j = i; j < ll; j++) { if (ss[j] == 'w') { n++; } } a = a + n*(n - 1) / 2; } else if (ss[i] == '\0') { break; } i++; } cout << a << endl; return 0; }