#include #include #include #include #include #include using namespace std; int calc(string gw, int idx, int d) { int holidays = 0; int max_holidays = 0; bool paid = (gw[idx] == 'x'); for (int i = 0; i < gw.size(); i++) { if (gw[i] == 'o' || (paid && idx <= i && i < idx + d)) { holidays++; } else { if (i >= idx) { paid = false; } max_holidays = max(max_holidays, holidays); holidays = 0; } } max_holidays = max(max_holidays, holidays); return max_holidays; } int main() { string in1, in2; int d; cin >> d >> in1 >> in2; string gw = in1 + in2; int ans = 0; for (int i = 0; i < gw.size(); i++) { ans = max(ans, calc(gw, i, d)); } cout << ans << endl; return 0; }