#include <iostream> #include <string> #include<algorithm> using namespace std; int main() { string s; cin >> s; int cnt_c = 0,cnt_w = 0; for(int i = 0; s[i] == 'c'; i++) cnt_c++; for(int i = s.length()-1; s[i] == 'w'; i--) cnt_w++; cout << min({cnt_c-1,cnt_w}) << endl; return 0; }