#include using namespace std; int main(){ string s; cin >> s; int wcount = 0,ccount = 0; for(int i = 0; i < s.size(); i++){ if(s[i] == 'w') wcount++; else ccount++; } cout << min(ccount-1,wcount) << endl; }