#include #include #include using ll = long long int; int main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); std::string s; std::cin >> s; std::vector isC; std::vector wCountFromRight; for(auto c : s){ switch(c){ case 'c': isC.push_back(true); wCountFromRight.push_back(0); break; case 'w': isC.push_back(false); wCountFromRight.push_back(1); break; } } //累積和 for(int i=wCountFromRight.size()-2; i>=0; --i){ wCountFromRight[i] += wCountFromRight[i+1]; } ll ans = 0; for(size_t i=0; i