#include using namespace std; #define FOR(i,s,e) for(int (i)=(s);(i)<(int)(e);(i)++) #define REP(i,e) FOR(i,0,e) #define RFOR(i,e,s) for(int (i)=(e)-1;(i)>=(int)(s);(i)--) #define RREP(i,e) RFOR(i,e,0) #define all(o) (o).begin(), (o).end() #define psb(x) push_back(x) #define mp(x,y) make_pair((x),(y)) typedef long long ll; typedef pair PII; typedef priority_queue PQI; typedef priority_queue PQII; const double EPS = 1e-10; const int N = 1e5; int w[N+1]; int main() { string s; cin >> s; int n = (int)s.size(); memset(w, 0, sizeof(w)); RREP(i,n) w[i] = w[i+1] + (s[i]=='w' ? 1 : 0); ll res = 0; REP(i,n-2) res += s[i]=='c' ? (ll)w[i+1]*(w[i]-1)/2 : 0; printf("%lld\n", res); return 0; }