#include #include #include #include //#include #include #include #include #include #include //#include #include #include #include //#include #include #include //#include #include #include #include #include const int dx[] = {1, 0, -1, 0}; const int dy[] = {0, 1, 0, -1}; using namespace std; typedef long long ll; typedef vector vi; typedef vector vll; typedef pair pii; int main() { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; int n = s.size(); int ans = 150; for (int i = 0; i < n; i++) for (int j = i+1; j < n; j++) for (int k = j+1; k < n; k++) if (s[i] == 'c' && s[j] == 'w' && s[k] == 'w') { ans = min(ans, k-i+1); } if (ans == 150) ans = -1; cout << ans << endl; return 0; }