#include using namespace std; namespace { char S[ 100100 ]; int A[ 100100 ]; } int main() { int i; int iLen; int x; int y; char C; int iCnt; int iMin; cin >> S; i = 0; iCnt = 0; while( ( C = S[ i ] ) != '\0' ) { if( C == 'c' ) { if( S[ i + 1 ] == 'c' && S[ i + 2 ] == 'w' ) { A[ iCnt ] = i; iCnt++; i += 3; continue; } } i++; } iLen = i; if( iCnt == 0 ) { cout << 0 << endl; return 0; } x = A[ iCnt - 1 ] + 1; y = iLen - A[ 0 ] - 2; if( x > y ) iMin = y; else iMin = x; y = iCnt - 1; for( i = 0; i < y; i++ ) { x = ( A[ i ] + 1 ) + ( iLen - A[ i + 1 ] - 2 ); if( iMin > x ) iMin = x; } cout << iMin << endl; return 0; }