#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define fst first #define scd second #define PB push_back #define MP make_pair #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define omajinai ios::sync_with_stdio(false);cin.tie(0) #define rep(i,x) for(int i=0;i<(int)(x);++i) #define rep1(i,x) for(int i=1;i<=(int)(x);++i) using ll=long long; using ld=long double; using vi=vector; using vvi=vector; using pii=pair; using vpii=vector; templateostream&operator<<(ostream&os,const pairp){os<<"("<ostream&operator<<(ostream&os,const vectorv){rep(i,v.size()){if(i)os<<", ";os<T&max(T&a,T&b){if(a>=b)return a;return b;} templateT&min(T&a,T&b){if(a < b)return a;return b;} templatebool chmax(T&a,T b){if(a < b){a=b;return true;}return false;} templatebool chmin(T&a,T b){if(a > b){a=b;return true;}return false;} int in(){int a;scanf("%d",&a);return a;} ll lin(){ll a;scanf("%lld",&a);return a;} constexpr int inf = 1e9; constexpr ll linf = 3e18; constexpr double eps = 1e-9; int main() { string s; cin >> s; int cnt[2]={}; rep(i, s.size())cnt[s[i]=='w']++; cout << min(cnt[0] - 1, cnt[1]) << endl; }