#include #include #include int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); std::string s; std::cin >> s; int cnt = 0, wcnt = 0; for (std::string::size_type i = s.length() - 1; i != static_cast(-1); i--) { switch (s[i]) { case 'c': cnt += wcnt * (wcnt - 1) / 2; break; case 'w': wcnt++; break; } } std::cout << cnt << std::endl; return EXIT_SUCCESS; }