#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ull = unsigned long long; using ll = long long; int main() { string s; cin >> s; int count = 0; int start = -1; int end = 0; int tmp = 0; for(int i = s.size()-1; i >= 0; --i) { if(s.at(i) == 'w') { ++count; if(count >=2) end = tmp; tmp = i; } if(count >=2 && s.at(i) == 'c') { start = i; } } if(start == -1) cout << -1 << endl; else cout << end -start+1 << endl; }