#include using namespace std; int main() { string S; cin >> S; int x = S.find('w'), y = S.size(); cout << min(x - 1, y - x) << "\n"; }