#include #include #include #include #include #include #include #include using namespace std; typedef long long int ll; typedef pair pii; typedef tuple tiii; typedef vector vi; #define REP(i,x) for(int i=0;i<(int)(x);i++) #define ALL(container) (container).begin(), (container).end() int main(){ string s; cin >> s; int cCount = 0; int wCount = 0; ll sum = 0; for(int i = s.length()-1;i >= 0;i--) { if(s[i] == 'c') { if(wCount >=2) { ll count = wCount * (wCount-1)/2; sum += count; } cCount++; } else if(s[i] == 'w') { wCount++; } } cout << sum << endl; return 0; }