#include using namespace std; int INF = 100000; int main(){ string S; cin >> S; int N = S.size(); int ans = INF; 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 == INF){ cout << -1 << endl; } else { cout << ans << endl; } }