#include #include using namespace std; long long nC2(long long a){ if(a < 2) return 0; return a * (a-1) / 2 ; } int main() { cin.tie(0); ios::sync_with_stdio(false); vector vec; long long ans = 0,temp = 0; for(char c; cin >> c ;){ if( c == 'c'){ vec.push_back(0); } if(c == 'w' ){ if(vec.size() > 0) vec[vec.size()-1]++; } } //for(int i = 0; i < vec.size();i++) cout << vec[i] << " "; for(long long i = vec.size()-1; 0 <= i; i--){ ans += nC2(vec[i]+temp); temp += vec[i]; } cout << ans << endl; return 0; }