#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; string s; int solve(){ int countt = 0; int maxt = 0; for (int i = 0; i < s.size(); i++){ if (s[i] == 'o'){ countt++; maxt = max(maxt, countt); } else{ countt = 0; } } return maxt; } char ss = 'o'; int main(){ int d; cin >> d; cin >> s; string t; cin >> t; s += t; string k; k.clear(); for (int i = 0; i < d+1; i++){ k.push_back('x'); } s += k; s = k + s; string tmp=s; int ans = 0; for (int i = 0; i < s.size(); i++){ s = tmp; bool ok = false; for (int j = i; j < s.size() && j < i + d; j++){ if (s[j] == ss){ break; } s[j] = ss; } ans = max(ans, solve()); } cout << ans << endl; return 0; }