#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000006;
template <typename T>
inline void read(T &AKNOI) {
  T x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  AKNOI = flag * x;
}
char s[MAXN];
int n, k, l;
int a[MAXN], f[MAXN], g[MAXN];
bool check(int m) {
  for (int i = l; i <= n; ++i) {
    f[i] = f[i - 1] + a[i];
    g[i] = g[i - 1];
    if (f[i] - f[i - l] > m) {
      f[i] = f[i - l] + m;
      g[i] = g[i - l] + 1;
    }
  }
  return g[n] <= k;
}
int work() {
  for (int i = 1; i < l; ++i) {
    f[i] = f[i - 1] + a[i];
  }
  int L = 0, R = n, p;
  while (L <= R) {
    int m = (L + R) >> 1;
    if (check(m)) {
      p = m;
      R = m - 1;
    } else {
      L = m + 1;
    }
  }
  check(p);
  return f[n] - k * p;
}
void solve() {
  read(n);
  read(k);
  read(l);
  if (1LL * k * l >= n) {
    printf("0\n");
    return;
  }
  scanf("%s", s + 1);
  for (int i = 1; i <= n; ++i) {
    a[i] = ('a' <= s[i] && s[i] <= 'z');
  }
  int ans = work();
  for (int i = 1; i <= n; ++i) {
    a[i] ^= 1;
  }
  printf("%d\n", min(ans, work()));
}
int main() {
  solve();
  return 0;
}
