#include #include #include #include using namespace std; int main() { string s; cin >> s; int result = numeric_limits::max(); for (size_t c = 0; c < s.size(); ++c) { if (s[c] != 'c') { continue; } for (size_t w1 = c + 1; w1 < s.size(); ++w1) { if (s[w1] != 'w') { continue; } for (size_t w2 = w1 + 1; w2 < s.size(); ++w2) { if (s[w2] != 'w') { continue; } result = min(result, (int)(w2 - c + 1)); } } } if (result == numeric_limits::max()) { result = -1; } cout << result << endl; return 0; }