#include #include /* * [No.346 チワワ数え上げ問題 - yukicoder](http://yukicoder.me/problems/987 "No.346 チワワ数え上げ問題 - yukicoder") * 提出者 : まろ * 使用言語 C++ */ using namespace std; auto main() -> int { string s; cin >> s; auto count = 0L, answer = 0L; for (auto it = s.rbegin(); it != s.rend(); ++it) { const auto &c = (*it); if (c == 'c' && count > 1) { answer += count * (count - 1L) / 2L; } else if (c == 'w') ++count; } cout << answer << endl; return 0; }