#include <bits/stdc++.h>
using namespace ::std;
const long long maxn = 1e5 + 500;
const long long mod = 1e9 + 7;
const long long inf = 1e9 + 500;
long long pr[maxn][2];
pair<long long, long long> dp[maxn];
long long par[maxn];
long long baze(long long r, long long l) {
  if (l == 0) {
    return par[r];
  }
  return par[r] - par[l - 1];
}
int main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long t;
  cin >> t;
  if (s[0] == '?') {
    par[0]++;
  }
  for (long long i = 0; i < n; i++) {
    par[i] = par[i - 1];
    if (s[i] == '?') {
      par[i]++;
    }
  }
  pr[n][0] = 0;
  pr[n][1] = 0;
  for (long long i = n - 1; i >= 0; i--) {
    if (s[i] == '?' || s[i] == 'a') {
      pr[i][0] = pr[i + 1][1] + 1;
    }
    if (s[i] == '?' || s[i] == 'b') {
      pr[i][1] = pr[i + 1][0] + 1;
    }
  }
  for (long long i = n - 1; i >= 0; i--) {
    dp[i] = dp[i + 1];
    if (pr[i][0] >= t) {
      dp[i] = max(dp[i], make_pair(dp[i + t].first + 1,
                                   -(-dp[i + t].second + baze(i + t - 1, i))));
    }
  }
  cout << -dp[0].second;
}
