#include #define int long long using namespace std; signed main(){ string S; cin >> S; bool fg1 = false; bool fg2 = false; int cnt = 0; int ans = 10000000; for( int i = 0; i < S.size(); i++ ){ cnt++; if( S.at(i) == 'c' ){ if( fg2 == false ){ fg1 = true; cnt = 1; } }else if( S.at(i) == 'w' ){ if( fg2 ){ ans = min(ans, cnt); fg1 = false; fg2 = false; }else if( fg1 == true && fg2 == false ){ fg2 = true; } } } if( ans != 10000000 ) cout << ans << endl; else cout << -1 << endl; }