#include using namespace std; #define REP(i, n) for(int i = 0; i < n; i++) int main(){ cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; string t = ""; REP(i, s.size()){ if(s[i] == 'c' or s[i] == 'w') t += s[i]; } vector A(t.size(), 0); int c = 0, w = 0, endw = 1e9; REP(i, t.size()){ if(t[i] == 'c'){ A[i] = c + 1; c++; }else{ A[i] = w + 1; w++; endw = i; } } if(endw == 1e9){ cout << 0 << endl; return 0; } int ans = 0; REP(i, t.size()){ if(t[i] == 'c'){ for(int j = i + 1; j < t.size(); j++){ if(t[j] == 'w'){ int r = A[endw] - A[j] + 1; ans += r * (r - 1) / 2; break; } } } } cout << ans << endl; return 0; }