#include #define REP(i,n) for(int i=0;i<(int)(n);i++) #define ALL(x) (x).begin(),(x).end() using namespace std; typedef long long ll; typedef long double ld; const ld eps = 1e-9, pi = acos(-1.0); int main() { string str; cin >> str; int N = str.size(); int res = 1e9; REP(i,N) REP(j,i) REP(k,j) if (str[k] == 'c' && str[j] == 'w' && str[i] == 'w') res = min(res, i - k + 1); cout << (res == 1e9 ? -1 : res) << endl; return 0; }