#include using namespace std; int main() { string S; cin >> S; int c = 0; for( int i = 0; i < S.size(); i++ ) { if( S[i] == 'c' ) c++; } int w = S.size() - c; int ans = 0; if( c >= 2 && w ) ans = min( c - 1, w ); cout << ans << endl; }