#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair i_i; typedef pair ll_i; typedef pair d_i; typedef pair ll_ll; typedef pair d_d; struct edge { int v, w; }; ll MOD = 1000000007; ll _MOD = 1000000009; double EPS = 1e-10; int f(string& s) { int maxi = 0; for (int i = 0; i <= 14; i++) for (int j = i; j <= 14; j++) { bool ok = true; for (int k = i; k < j; k++) if (s[k] == 'x') ok = false; if (ok) maxi = max(maxi, j - i); } return maxi; } int main() { int D; cin >> D; string s, t; cin >> s >> t; s = s + t; int maxi = 0; for (int i = 0; i + D <= 14; i++) { string _s = s; for (int j = i; j < i + D; j++) _s[j] = 'o'; maxi = max(maxi, f(_s)); } cout << maxi << endl; }