#include using namespace std; namespace { typedef double real; typedef long long ll; template ostream& operator<<(ostream& os, const vector& vs) { if (vs.empty()) return os << "[]"; os << "[" << vs[0]; for (int i = 1; i < vs.size(); i++) os << " " << vs[i]; return os << "]"; } template istream& operator>>(istream& is, vector& vs) { for (auto it = vs.begin(); it != vs.end(); it++) is >> *it; return is; } int D; string s; void input() { cin >> D; cin >> s; string t; cin >> t; s += t; s = string(20, 'x') + s + string(20, 'x'); } void solve() { int ans = 0; int N = s.size(); for (int i = 0; i < N; i++) { for (int j = i + 1; j <= N; j++) { bool flag = true; int z = -1; for (int k = i; k < j; k++) { if (s[k] == 'x') { if (z < 0) { z = k; } else if (z + D < k) { flag = false; } } } if (flag) { ans = max(ans, j - i); } } } cout << ans << endl; } } int main() { input(); solve(); return 0; }