#include using namespace std; int main() { string str; cin >> str; const int inf = 1 << 28; int ans = inf; for (int i = 0; i < str.size() - 2; i++) { int j = i; while (j < str.size() && str[j] != 'c')j++; j++; while (j < str.size() && str[j] != 'w')j++; j++; while (j < str.size() && str[j] != 'w')j++; if (j < str.size()) ans = min(ans, j - i + 1); } if (ans < inf) cout << ans << endl; else cout << -1 << endl; return 0; }