#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { string S; cin >> S; int ans = 999, sta = 0; bool flag; for (int l = 0; l < S.size(); l++) { if (S[l] == 'c') { flag = false; for (int m = l + 1; m < S.size() - 1; m++) { if (S[m] == 'w' && !flag) { for (int r = m+1; r < S.size(); r++) { if (S[r] == 'w') { ans = min(ans, r-l+1); //cout << "l: " << l << " m: " << m << " r: " << r << " ans: " << ans << endl; flag = true; break; } } if (flag) break; } } } } if (ans == 999) cout << -1 << endl; else cout << ans << endl; return 0; }