#include "bits/stdc++.h" #define rep(i,n) for(int i = 0;i < n;i++) #define REP(i,n,k) for(int i = n;i < k;i++) #define P(p) cout << (p) << endl; #define sP(p) cout << setprecision(15) << fixed << p << endl; #define pi 3.1415926535 #define IINF 1e9 #define LINF 1e18 #define vi vector #define mp make_pair using namespace std; typedef long long ll; typedef unsigned long long ull; int dx[] = { 0, 1, 0, -1 }; int dy[] = { -1, 0, 1, 0 }; unsigned long long sttoi(std::string str) { unsigned long long ret; std::stringstream ss; ss << str; ss >> ret; return ret; } ull gcd(ull a, ull b){ if (b > a)swap(a, b); if (b == 0) return a; return gcd(b, a%b); } void solve() { int n; cin >> n; string s, t; cin >> s >> t; s = "xxxxxxxxxxxxxxxxxxx" + s + t + "xxxxxxxxxxxxxxxxxxxx"; int maxi = -1; rep(i, s.length()-14){ int streak = 0; bool can = true; for (int k = 0; k <= n; k++){ rep(j, k){ if (s[i + j] == 'o')can = false; } if (can){ string tmp = s; rep(j, k){ tmp[i + j] = 'o'; } streak = 0; rep(j, tmp.length()){ if (tmp[j] == 'o'){ streak++; } else{ maxi = max(maxi, streak); streak = 0; } } } } } P(maxi); } int main() { solve(); return 0; }