#include using namespace std ; #define pb(n) push_back(n) #define fi first #define se second #define np string::npos #define X real() #define Y imag() #define value(x,y,w,h) (x >= 0 && x < w && y >= 0 && y < h) #define all(r) (r).begin(),(r).end() #define gsort(st,en) sort((st),(en),greater()) #define vmax(ary) *max_element(all(ary)) #define vmin(ary) *min_element(all(ary)) #define debug(x) cout<<#x<<": "< di ; typedef deque dl ; typedef map dict; typedef complex comd; typedef pair pii; constexpr int imax = ((1<<30)-1)*2+1 ; constexpr int inf = 100000000; constexpr double PI = acos(-1.0) ; double eps = 1e-10 ; const int dy[] = {-1,0,1,0}; const int dx[] = {0,-1,0,1}; double CalcDist(comd p1, comd p2){ return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0)); } template void out(deque < T > d) { for(size_t i = 0; i < d.size(); i++) { debug(d[i]); } } template T ston(string& str, T& n){ istringstream sin(str) ; T num ; sin >> num ; return num ; } int main(){ cin.tie(0); ios::sync_with_stdio(false); string str; long long int ans = 0,wn = 0,sum = 0; cin >> str; deque d(str.size(),0); for(int i = str.size()-1; i >= 0;--i){ if(str[i] == 'w'){ sum += wn; d[i] = sum; ++wn; } } rep(i,str.size()){ auto it = str.begin(); if(str[i] == 'c'){ if(find(it,str.end(),'w') == str.end()){ break; } for(int j = i+1; j < str.size(); ++j){ if(str[j] == 'w'){ ans += d[j]; break; } } } } cout << ans << endl; return 0; }