#include #include #include using namespace std; int main() { string s; cin >> s; string tmp[100]; int t = 0; for(int i = 0; i < s.length(); i++) { if (s[i] == 'c') { int cntw = 0; for (int j = i; j < s.length(); j++) { if (s[j] == 'w') cntw++; if (cntw == 2) { tmp[t++] = s.substr(i,j - i + 1); break; } } } } int ans = 110; for (int i = 0; i < 100; i++) { // cout << tmp[i].length() << " "; t = tmp[i].length(); ans = !t ? ans : min(ans, t); } cout << (ans == 110 ? -1 : ans) << endl; return 0; }