#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using VLL = vector<LL>;
using vi = vector<int>;
using pii = pair<int, int>;
const int N = 1e6 + 10;
int n, k, l;
char a[N];
int s[N];
double dp[N];
int cnt[N];
int check(double c) {
  dp[0] = cnt[0] = 0;
  for (int i = 1; i <= n; i++) {
    dp[i] = dp[i - 1];
    cnt[i] = cnt[i - 1];
    if (i >= l) {
      if (dp[i - l] + (s[i] - s[i - l]) - c > dp[i]) {
        dp[i] = dp[i - l] + (s[i] - s[i - l]) - c;
        cnt[i] = cnt[i - l] + 1;
      }
    }
  }
  return cnt[n];
}
LL func() {
  int big = 0;
  s[0] = 0;
  for (int i = 1; i <= n; ++i) {
    s[i] = s[i - 1];
    if (a[i] >= 'a' && a[i] <= 'z')
      s[i]++;
    else
      big++;
  }
  LL res;
  LL lo = 0, hi = n;
  while (lo <= hi) {
    LL mid = (lo + hi) / 2;
    if (check(mid) > k) {
      lo = mid + 1;
      res = mid;
    } else
      hi = mid - 1;
  }
  if (check(res) <= k) return n;
  check(res + 1);
  LL ans = big + dp[n] + 1ll * (res + 1) * k;
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  while (~scanf("%d%d%d", &n, &k, &l)) {
    scanf("%s", a + 1);
    int ans = n + 1;
    int v1 = func();
    ans = min(ans, n - v1);
    for (int i = 1; i <= n; i++) {
      if (a[i] >= 'A' && a[i] <= 'Z')
        a[i] = a[i] - 'A' + 'a';
      else
        a[i] = a[i] - 'a' + 'A';
    }
    int v2 = func();
    ans = min(ans, n - v2);
    printf("%d\n", ans);
  }
  return 0;
}
