#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
int n, k, l, sm[MAXN];
char s[MAXN];
pair<long long, long long> dp[MAXN];
long long solve(char a) {
  for (int i = 1; i <= n; i++) sm[i] = sm[i - 1] + (s[i] == a);
  int lo = 0, hi = l;
  long long ans = 0;
  while (lo <= hi) {
    int mi = (lo + hi) / 2;
    for (int i = 1; i <= l; i++) dp[i] = max(dp[i - 1], {sm[i] - mi, -1});
    for (int i = l + 1; i <= n; i++)
      dp[i] = max(dp[i - 1], {dp[i - l].first + sm[i] - sm[i - l] - mi,
                              dp[i - l].second - 1});
    if (-dp[n].second <= k)
      hi = mi - 1, ans = dp[n].first;
    else
      lo = mi + 1;
  }
  return sm[n] - k * lo - ans;
}
int main() {
  scanf("%d %d %d", &n, &k, &l);
  scanf("%s", s + 1);
  if ((long long)k * (long long)l >= n) return !printf("0\n");
  for (int i = 1; i <= n; i++) s[i] = 'a' <= s[i] ? 'a' : 'b';
  printf("%I64d\n", min(solve('a'), solve('b')));
  return 0;
}
