#include #include using namespace std; int f(string a) { a += "x"; int ma = 0; bool st = true; int s; for (int i = 0; i < a.size(); ++i) { if (st && a[i] == 'o') { s = i; st = false; } else if (!st && a[i] == 'x') { ma = max(ma, i - s); st = true; } } return ma; } int main() { int d; cin >> d; string a = "xxxxxxxxxxxxxx"; string s = ""; for (int i = 0; i < 2; ++i) { string t; cin >> t; s += t; } s = a + s + a; int ma = 0; for (int i = 0; i < s.size() - 14; ++i) { string t = s; for (int j = 0; j < d; ++j) t[i+j] = 'o'; ma = max(ma, f(t)); } cout << ma << endl; }