#include #include #include using namespace std; int t, cnt; int main() { string s; int ans = 101; cin >> s; for (auto& e : s) { if (e == 'c') { t = 1; cnt = 1; } else if (e == 'w') { if (t == 1) { t++; cnt++; } else if (t == 2) { cnt++; t = 0; ans = min(ans, cnt); } } else { cnt++; } } if (ans == 101) ans = -1; cout << ans << endl; }