#include "bits/stdc++.h" #ifndef err #define err(...) #define DebugWriteLine(...) #endif using namespace std; void Calc(); #define ALL(win) begin(win),end(win) #define RALL(win) (win).rbegin(),(win).rend() typedef int64_t ll; typedef uint64_t ull; int main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cin.exceptions(istream::failbit | istream::badbit); Calc(); cout.flush(); return 0; } template struct Iter { T&operator++() { return ++i; } constexpr const T&operator*() const { return i; } constexpr bool operator!=(const Iter &o) const { return i != o.i; } T i; }; struct Scanner { templatestatic A Next() { A a; cin >> a; return a; } templatestatic vector Array(int n) { vector a(n); for (A&i : a) cin >> i; return a; } static string Line() { string s; getline(cin, s); return s; } static int Int() { return Next(); } templateScanner&operator,(A&a) { a = Next(); return *this; } templateoperator A() { return Next(); } }in; /*---------------------------------------------------------------------*/ void Calc() { ll w_cnt = 0; string s = in; int n = s.size(); ll cnt = 0; for (int i = n - 1; i >= 0; i--) { if (s[i] == 'w') w_cnt++; if (s[i] == 'c') { if (w_cnt < 2) continue; cnt += (w_cnt - 1)*w_cnt / 2; } } cout << cnt << endl; }