#include #include using namespace std; typedef long long ll; int main() { ios::sync_with_stdio( false ); string s; cin >> s; ll n = 0; ll ret = 0; for( int i=s.size()-1; i>=0; i-- ){ if( s[i] == 'w' ) { n++; } else if( s[i] == 'c' ) { ret += n * (n-1) / 2; } } cout << ret << endl; }