#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pi; typedef pair pl; typedef pair pls; int main() { int D,ans = 0; cin >> D; string c1, c2,c3,c_temp; cin >> c1 >> c2; c3 = "xxxxxxxxxxxxxx"; c1 =c3 + c1 + c2 + c3; c_temp = c1; for (int i = 0; i < c1.size(); i++) { int cnt = 0, cnt_mx = 0; c1 = c_temp; if (c1[i] == 'x') { for (int j = 0; j < D; j++) { if (i + j < c1.size()) { if (c1[i + j] != 'x')break; c1[i + j] = 'o'; } } for (int j = 0; j < c1.size(); j++) { if (c1[j] != 'x') cnt++; else cnt = 0; cnt_mx = max(cnt_mx, cnt); } } ans = max(ans,cnt_mx); } cout << ans << endl; return 0; }