#include #include #include using namespace std; int main() { string S; cin >> S; int ans = -1; int i = 0; int len = 200; char stat = 'c'; int tmp; while( true ) { if( S[i] == '\0' ) { if( stat == 'c' ) { break; } i = tmp+1; stat = 'c'; continue; } switch( stat ) { case 'c': if( S[i] == 'c' ) { stat = 'w'; tmp = i; } i++; break; case 'w': if( S[i] == 'w' ) { stat = 'W'; } i++; break; case 'W': if( S[i] == 'w' ) { len = min( len, i - tmp + 1 ); i = tmp; stat = 'c'; } i++; } } len = len==200 ? -1: len; cout << len << endl; return 0; }