#include <bits/stdc++.h>
#pragma GCC optimize("-Ofast", "-funroll-all-loops")
using namespace std;
const long long N = 1e6 + 10;
long long n, k, l, a[N], sum[N], dp[N], f[N];
char str[N];
inline long long check(long long mid) {
  for (long long i = 1; i <= n; i++) {
    dp[i] = dp[i - 1], f[i] = f[i - 1];
    if (i >= l && dp[i] < dp[i - l] + sum[i] - sum[i - l] - mid)
      dp[i] = dp[i - l] + sum[i] - sum[i - l] - mid, f[i] = f[i - l] + 1;
    else if (i < l && dp[i] < sum[i] - mid)
      dp[i] = sum[i] - mid, f[i] = 1;
  }
  return f[n];
}
inline long long calc(long long flag) {
  for (long long i = 1; i <= n; i++)
    a[i] = flag ^ (str[i] >= 'A' && str[i] <= 'Z');
  long long l = 0, r = n, res = 0, ans;
  for (long long i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i];
  res += sum[n];
  while (l <= r) {
    long long mid = l + r >> 1;
    if (check(mid) <= k)
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  check(ans);
  return res - dp[n] - k * ans;
}
signed main() {
  cin >> n >> k >> l;
  scanf("%s", str + 1);
  cout << min(calc(1), calc(0));
  return 0;
}
