#include using namespace std; int main() { string S; cin >> S; int N = S.size(); int ans = 1e9; for (int i = 0; i < N; i++) { if (S[i] == 'c') { for (int j = i + 1; j < N; j++) { if (S[j] == 'w') { for (int k = j + 1; k < N; k++) { if (S[k] == 'w') { ans = min(ans, k - i + 1); } } } } } } if (ans == 1e9) { cout << -1; } else { cout << ans; } }