#include #include #include #include int fact(int n){ return n == 0 ? 0 : fact(n-1) + n; } int chiwawa(std::string const& input){ int result = 0; std::size_t c = -1; while(1){ c = input.find('c', c+1); if( c == std::string::npos || c >= input.size() ) break; auto ws = std::count(std::begin(input)+c, std::end(input), 'w'); if( ws == 0 ) break; result += fact(ws-1); } return result; } int main(){ std::string str{}; std::cin >> str; auto result = chiwawa(str); std::cout << result << std::endl; return 0; }