#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define mp make_pair #define pb push_back #define all(x) (x).begin(),(x).end() #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector vb; typedef vector vi; typedef vector vvb; typedef vector vvi; typedef pair pii; const int INF=1<<29; const double EPS=1e-9; const int dx[]={1,0,-1,0},dy[]={0,-1,0,1}; int kyuujitu(string s) { int count = 0; int ma = 0; for (int i = 0; i < s.size(); ++i) { if (s[i] == 'o') { count++; } else { ma = max(ma, count); count = 0; } } return max(ma, count); } int main(int argc, char const *argv[]) { int D; cin >> D; string s1, s2; cin >> s1 >> s2; s1 += s2; s1 = "xxxxxxxxxxxxxx" + s2 + "xxxxxxxxxxxxxx"; string s3 = s1; int ans = 0; if (D == 0) { cout << kyuujitu(s1) << endl; return 0; } for (int i = 0; i < (s1.size() - D + 1); ++i) { s1 = s3; for (int j = 0; j < D; ++j) { if (s1[i + j] == 'o') break; s1[i + j] = 'o'; } ans = max(ans, kyuujitu(s1)); } cout << ans << endl; return 0; }