#include #include #include #include #include #include #include #include #include #include #include #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); #define llong long long #define pb(a) push_back(a) using namespace std; typedef long long int ll; typedef pair pii; typedef pair pll; template vector make_v(size_t a) { return vector(a); } template auto make_v(size_t a, Ts... ts) { return vector(ts...))>(a, make_v(ts...)); } template typename enable_if::value == 0>::type fill_v(T& t, const V& v) { t = v; } template typename enable_if::value != 0>::type fill_v(T& t, const V& v) { for (auto& e : t) fill_v(e, v); } #define ARRAY_MAX 100005 const ll INF = (1LL << 31) - 1; const ll MOD = 1e9 + 7; int dx[4] = { 1,0,0,-1 }; int dy[4] = { 0,1,-1,0 }; /******************************************************************************************/ ll dp[100005][4]; int main() { string s; cin >> s; string cw = "cww"; dp[0][0] = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == 'c') { dp[i][0]++; } else if (s[i] == 'w') { dp[i + 1][2] += dp[i][1]; dp[i + 1][1] += dp[i][0]; } dp[i + 1][0] += dp[i][0]; dp[i + 1][1] += dp[i][1]; dp[i + 1][2] += dp[i][2]; } cout << dp[s.size()][2] << endl; return 0; }