#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define INF (INT_MAX/3) #define PI (2*acos(0.0)) #define EPS (1e-8) typedef long long ll; typedef unsigned long long ull; int check(const string& bk){ int cnt = 0, ret = 0; for(int i = 0; i < 14; i++){ if(bk[i] == 'o') cnt++; else cnt = 0; ret = max(ret, cnt); } return ret; } int main(){ ios_base::sync_with_stdio(0); int D; string d, t; cin >> D; cin >> d >> t; d += t; int m = 0; for(int i = 0; i < 14; i++){ string bk = d; bool ok = true; for(int j = i; j < i + D; j++){ if(j == 14 || bk[j] == 'o') {ok = false; break;} } if(!ok) continue; for(int j = i; j < i + D; j++){ if(j == 14) break; if(bk[j] == 'x') bk[j] = 'o'; } m = max(m, check(bk)); } cout << m << endl; return 0; }