#include int main() { char s[100001]; char cww[100000] = {0}; std::cin >> s; int index = 0; int w = 0; for(int i = 0; s[i]; i++) { if((s[i] == 'c') || (s[i] == 'w')) { cww[index] = s[i]; index++; } if(s[i] == 'w') w++; } int ret = 0; for(int i = 0; cww[i]; i++) { if(cww[i] == 'w') w--; if(cww[i] == 'c') ret += (w * (w + 1)) / 2; } std::cout << ret << std::endl; return 0; }