#include #include using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define FORR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define pb push_back #define ALL(a) (a).begin(),(a).end() typedef long long ll; int main() { string S; cin >> S; ll sm = 0; ll w = 0; RREP(i, S.length()) { if (S[i] == 'w') { w++; } if (S[i] == 'c') { sm += w * (w - 1) / 2; } } cout << sm << endl; return 0; }