#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(a,b) for(long long a = 0;a < b;++a) int main() { string joke; cin >> joke; string s; for (int i = joke.length()-1;i >= 0;--i) { s.push_back(joke[i]); } long long ans = 0; int counter_w = 0; for (int i = 0;i < s.length();++i) { if (s[i] == 'w') { counter_w++; } else if (s[i] == 'c') { if (counter_w >= 2) ans += counter_w*(counter_w - 1) / 2; } } cout << ans << endl; }