#include using namespace std; bool ok( string s ){ int st = 0; for( int i = 0; i < s.size(); ++i ){ if( st == 0 and s[ i ] == 'c' ) st = 1; else if( st == 1 and s[ i ] == 'w' ) st = 2; else if( st == 2 and s[ i ] == 'w' ) return true; } return false; } signed main(){ string s; cin >> s; int ans = 1e9; for( int i = 0; i < s.size(); ++i ) for( int j = i; j < s.size(); ++j ) if( ok( s.substr( i, j - i + 1 ) ) ) ans = min( ans, j - i + 1 ); if( ans == ( int ) 1e9 ) cout << -1 << endl; else cout << ans << endl; return 0; }