#include #include #include using namespace std; int main() { string s; regex regex("c.*w.*w"); smatch match; int min = 100; cin >> s; if (regex_search(s, match, regex) == false) { cout << -1 << endl; return 0; } for (size_t i = 0; i < match.size(); ++i) { if (match.length(i) < min) { min = match.length(i); } } cout << min << endl; return 0; }