#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
int N, K, L, H;
int awa, akh, cen, res;
int P[MAXN];
int D[MAXN];
bool A[MAXN];
bool B[MAXN];
char C;
int dp(int x) {
  for (int i = 1; i <= N; i++) {
    D[i] = D[max(0, i - L)] + P[i] - P[max(0, i - L)] - x;
    B[i] = 1;
    if (D[i] <= D[i - 1]) {
      D[i] = D[i - 1];
      B[i] = 0;
    }
  }
  int ret = 0;
  for (int i = N; i; i--) {
    if (B[i]) {
      ret++;
      i -= min(i, L) - 1;
    }
  }
  return ret;
}
int monge() {
  for (int i = 1; i <= N; i++) {
    P[i] = P[i - 1] + A[i];
  }
  awa = 0;
  akh = L;
  res = L;
  while (awa <= akh) {
    cen = (awa + akh) / 2;
    if (dp(cen) <= K) {
      akh = cen - 1;
      res = cen;
    } else {
      awa = cen + 1;
    }
  }
  dp(res);
  return P[N] - D[N] - res * K;
}
void balik() {
  for (int i = 1; i <= N; i++) {
    A[i] = !A[i];
  }
  return;
}
void input() {
  cin >> N >> K >> L;
  for (int i = 1; i <= N; i++) {
    cin >> C;
    if (C >= 'a') {
      A[i] = 1;
    }
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  input();
  H = monge();
  balik();
  H = min(H, monge());
  cout << H << '\n';
  return 0;
}
