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