#include #include using namespace std; int main() { string s; int min = 101, i, j, n, flags; cin >> s; n = s.length(); for (i = 0; i < n; i++) { if (s[i] == 'c') { flags = 0; for (j = i; flags < 2 && j < n; j++) { if (s[j] == 'w') { flags++; } } if (flags == 2 && j - i < min) { min = j - i; } } } if (min == 101) { cout << -1 << endl; } else { cout << min << endl; } return 0; }