#include #include #include #define REP(i, a, b) for (int i = int(a); i < int(b); i++) #define dump(s) cerr << __LINE__ << "\t:" << #s << " = " << (s) << endl using namespace std; int main () { string s; cin >> s; const int inf = 1 << 30; int ans = inf; REP (i, 0, s.size()) { if (s[i] != 'c') continue; int w = 0; REP (j, i + 1, s.size()) { if (s[j] == 'w') w++; if (w == 2) { ans = min(ans, j - i + 1); } } } cout << (ans == inf ? -1 : ans) << endl; return 0; }