#include #include using namespace std; using namespace atcoder; using ll=int; using ld=long double; ld pie=3.141592653589793; ll inf=144494; ll mod=1000000007; int main(){ string s; cin >> s; reverse(s.begin(),s.end()); ll w=0; ll ans=0; for (ll i = 0; i < s.size(); i++) { if (s[i]=='c') { ans+=(w*(w-1))/2; }else if (s[i]=='w') { w+=1; } } cout << ans << endl; }