#include <bits/stdc++.h>
using namespace std;
int n, k, l;
int a[1000005];
char s[1000005];
pair<long long, int> dp[1000005];
pair<long long, int> check(int mid) {
  for (int i = 0; i <= n; i++) dp[i] = make_pair(1e18, 1e9);
  dp[0] = make_pair(0, 0);
  for (int i = 1; i <= n; i++) {
    if (dp[min(n, i + l - 1)] >
        make_pair(dp[i - 1].first + mid, dp[i - 1].second + 1)) {
      dp[min(n, i + l - 1)] =
          make_pair(dp[i - 1].first + mid, dp[i - 1].second + 1);
    }
    if (dp[i] > make_pair(dp[i - 1].first + a[i], dp[i - 1].second)) {
      dp[i] = make_pair(dp[i - 1].first + a[i], dp[i - 1].second);
    }
  }
  return dp[n];
}
long long solve() {
  int lo = 0, hi = n, ans;
  while (lo <= hi) {
    int mid = (lo + hi) / 2;
    if (check(mid).second <= k)
      ans = mid, hi = mid - 1;
    else
      lo = mid + 1;
  }
  pair<long long, int> res = check(ans);
  return res.first - ans * 1ll * res.second - ans * 1ll * (k - res.second);
}
int main() {
  scanf("%d%d%d", &n, &k, &l);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) {
    if ('A' <= s[i] && s[i] <= 'Z')
      a[i] = 1;
    else
      a[i] = 0;
  }
  long long ans = solve();
  for (int i = 1; i <= n; i++) {
    if ('A' <= s[i] && s[i] <= 'Z')
      a[i] = 0;
    else
      a[i] = 1;
  }
  ans = min(ans, solve());
  printf("%lld\n", ans);
}
