#include #include #include using namespace std; int main() { ios::sync_with_stdio(false); string s; queue q; cin >> s; int ret = 101; for( int i = s.size()-1; i>=0; i-- ){ if( s[i] == 'w' ){ q.push( i ); if( q.size() > 2 ) q.pop(); } if( s[i] == 'c' && q.size() == 2 ){ ret = min( ret, q.front() - i + 1 ); } } if( ret > 100 ) cout << -1 << endl; else cout << ret << endl; }