#include #include using namespace std; int main() { string s; getline( cin, s ); const int INIT = 10000; int ans = INIT; for( int i = 0; i < s.size(); i++ ) { if ( s[i] == 'c' ) { for( int j = i + 1; j < s.size(); j++ ) { if ( s[j] == 'w' ) { for( int k = j + 1; k < s.size(); k++ ) { if ( s[k] == 'w' ) { ans = min( ans, k - i + 1 ); } } } } } } if ( ans == INIT ) { cout << -1 << endl; } else { cout << ans << endl; } }