#include #include using namespace std; #define INF 1000 #define MIN(a,b) ((a)<(b)?(a):(b)) #define FOR(i,a,b) for (int i=(a);i<(b);i++) int main() { int n, len = INF; string s; cin >> s; n = s.size(); FOR(i, 0, n){ if (s[i] == 'c') { FOR(j, i + 1, n) { if (s[j] == 'w') { FOR(k, j + 1, n) { if (s[k] == 'w') { len = MIN(k - i + 1, len); }}}}}} cout << (len == INF ? -1 : len) << endl; return 0; }