#include <bits/stdc++.h>
std::pair<int64_t, int64_t> sub(int *a, int n, int l, int y) {
  std::vector<int64_t> aa(n + 1);
  std::vector<std::pair<int64_t, int64_t> > D(n + 1);
  aa[0] = 0;
  for (int i = 0; i < n; ++i) aa[i + 1] = aa[i] + a[i];
  for (int i = 0; i < l; ++i) D[i] = {0, 0};
  for (int i = l; i <= n; ++i) {
    D[i] = D[i - 1];
    std::pair<int64_t, int64_t> D2;
    D2.first = D[i - l].first + (aa[i] - aa[i - l]) - y;
    D2.second = D[i - l].second + 1;
    if (D2.first > D[i].first) D[i] = D2;
  }
  std::pair<int64_t, int64_t> DD;
  DD.second = (n + l - 1) / l;
  DD.first = aa[n] - DD.second * y;
  if (D[n].first >= DD.first) DD = D[n];
  return DD;
}
int64_t f(int *a, int n, int k, int l) {
  int lo = 0;
  int hi = n + 1;
  std::pair<int64_t, int64_t> p;
  while (lo < hi) {
    int mi = (lo + hi) / 2;
    p = sub(a, n, l, mi);
    if (p.second > k) {
      lo = mi + 1;
    } else {
      hi = mi;
    }
  }
  p = sub(a, n, l, lo);
  int64_t r = 0;
  for (int i = 0; i < n; ++i) r += a[i];
  return r - (p.first + k * lo);
}
int main() {
  int n, k, l;
  static char s[1000001];
  static int a[1000000];
  scanf("%d%d%d%s", &n, &k, &l, s);
  for (int i = 0; i < n; ++i) a[i] = (isupper(s[i]) ? 1 : 0);
  if ((int64_t)k * l >= n) {
    printf("0\n");
    return 0;
  }
  int v1 = f(a, n, k, l);
  for (int i = 0; i < n; ++i) a[i] ^= 1;
  int v2 = f(a, n, k, l);
  if (v2 < v1) v1 = v2;
  printf("%d\n", v1);
  return 0;
}
