#include using namespace std; int main() { string S; cin >> S; vector cc; vector ww; for( int i = 0; i < S.size(); i++ ) { if( S[i] == 'c' ) cc.push_back( i ); if( S[i] == 'w' ) ww.push_back( i ); } int ans = 101; for( int i = 0; i < cc.size(); i++ ) { int st = cc[i]; for( int j = 0; j < ww.size() - 1; j++ ) { if( ww[j] < st ) continue; for( int k = j + 1; k < ww.size(); k++ ) { int end = ww[k]; ans = min( ans, end - st + 1 ); } } } if( ans == 101 ) ans = -1; cout << ans << endl; }