#include #define rep(i,n) for(int i=0;i<(n);++i) #define all(a) (a).begin(),(a).end() using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); string S; cin >> S; int c_cnt = count(all(S), 'c'); int w_cnt = count(all(S), 'w'); c_cnt--; cout << min(c_cnt, w_cnt) << endl; return 0; }