#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pint; typedef vector vint; typedef vector vpint; #define mp make_pair #define fi first #define se second #define all(v) (v).begin(),(v).end() #define rep(i,n) for(int i=0;i<(n);i++) #define reps(i,f,n) for(int i=(f);i<(n);i++) int dx[4] = {1, 0, 0, -1}; int dy[4] = {0, 1, -1, 0}; int main(void){ string s; cin >> s; int s_size = s.size(); vector s_c; vector s_w; int cnt_c = 0; int cnt_w = 0; //c,wがどの場所にあるかを調べている rep(i, s_size){ if (s[i] == 'c'){ s_c.push_back(i); cnt_c++; } else if(s[i] == 'w'){ s_w.push_back(i); cnt_w++; } } int s_c_size = s_c.size(); int s_w_size = s_w.size(); int ans = 0; rep(i, s_c_size){ rep(j, s_w_size){ if (s_w[j] > s_c[i]){ ans += ((s_w_size - j) * (s_w_size - j - 1)) / 2; //(s_w_size - j) C 2 break; } } } printf("%d\n", ans); return 0; }