#include #include #include #include int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); std::string s; std::cin >> s; std::array ps{0, 0, 0}; std::string::size_type pos = -1; int idx = 0; for (const auto& c : {'c', 'w', 'w'}) { if ((pos = s.find(c, pos + 1)) == std::string::npos) { std::cout << -1 << std::endl; return EXIT_SUCCESS; } else { ps[idx++] = pos; } } std::cout << (ps[2] - ps[0] + 1) << std::endl; return EXIT_SUCCESS; }