#include using namespace std; int main() { string s; cin >> s; for (int ans = 1; ans <= s.size(); ans++) { bool ok = false; for (int i = 0; i + ans - 1 < s.size(); i++) { string t = s.substr(i, ans); bool c1 = false, c2 = false, c3 = false; for (int j = 0; j < t.size(); j++) { if (!c1 && t[j] == 'c') c1 = true; else if (t[j] == 'w') { if (!c1) continue; else if (!c2) c2 = true; else if (!c3) c3 = true; } } if (c1 && c2 && c3) ok = true; } if (ok) { cout << ans << endl; return 0; } } cout << -1 << endl; }