#include <bits/stdc++.h>
using namespace std;
long long n, k, l;
priority_queue<pair<long long, long long> > h;
long long a[1000010], b[1000010];
pair<long long, long long> dp[1000010];
pair<long long, long long> check(long long cst) {
  long long i;
  for (i = 1; i <= n; i++) {
    if (i >= l) {
      if (dp[i - 1].first + a[i] >= dp[i - l].first + l - cst) {
        dp[i] = make_pair(dp[i - 1].first + a[i], dp[i - 1].second);
      } else {
        dp[i] = make_pair(dp[i - l].first + l - cst, dp[i - l].second + 1);
      }
    } else {
      dp[i] = make_pair(dp[i - 1].first + a[i], dp[i - 1].second);
    }
  }
  return dp[n];
}
long long solve() {
  long long st, dr, mid;
  st = 1;
  dr = n;
  while (st <= dr) {
    mid = (st + dr) / 2;
    if (check(mid).second <= k)
      dr = mid - 1;
    else
      st = mid + 1;
  }
  return check(st).first + k * st;
}
int main() {
  FILE *fin = stdin;
  FILE *fout = stdout;
  long long i, sol;
  char c;
  fscanf(fin, "%lld%lld%lld\n", &n, &k, &l);
  for (i = 1; i <= n; i++) {
    c = fgetc(fin);
    if ('A' <= c && c <= 'Z') {
      a[i] = 1;
    } else {
      b[i] = 1;
    }
  }
  if (k * l >= n) {
    fprintf(fout, "0");
    return 0;
  }
  sol = solve();
  for (i = 1; i <= n; i++) {
    a[i] = b[i];
  }
  sol = max(sol, solve());
  if (sol > n) sol = n;
  fprintf(fout, "%lld", n - sol);
  return 0;
}
