#include #include /* * [No.346 チワワ数え上げ問題 - yukicoder](http://yukicoder.me/problems/987 "No.346 チワワ数え上げ問題 - yukicoder") * 提出者 : まろ * 使用言語 C++ */ using namespace std; auto chiwawa_length(int start, string s) -> size_t { auto count = 0; auto index = s.find('w', start + 1); while (index != (size_t)-1) { index = s.find('w', index + 1); ++count; } return count * (count - 1) / 2; } auto main() -> int { string s; cin >> s; char c = 'c'; auto index = s.find(c); auto count = 0; while (index != (size_t)-1) { count += chiwawa_length(index, s); index = s.find(c, index + 1); } cout << count << endl; return 0; }