#include #include constexpr int N = 42; void solve() { int dmax; std::cin >> dmax; std::string s; s += std::string(14, 'x'); for (int i = 0; i < 2; ++i) { std::string t; std::cin >> t; s += t; } s += std::string(14, 'x'); int ans = 0; for (int d = 0; d <= dmax; ++d) { for (int si = 0; si < N; ++si) { int cont = 0, max = 0; bool valid = true; for (int i = 0; i < N; ++i) { if (s[i] == 'o' && (si <= i && i < si + d)) valid = false; if (s[i] == 'o' || (si <= i && i < si + d)) { ++cont; } else { cont = 0; } max = std::max(max, cont); } if (valid) ans = std::max(ans, max); } } std::cout << ans << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }