#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const int max_n = 1000005;
int n, k, l;
char s[max_n];
int a[max_n];
pair<long long, int> dp[max_n];
pair<long long, int> cal(int x) {
  for (int i = 0; i <= n; i++) dp[i] = pair<long long, int>(inf, 0);
  dp[0] = pair<long long, int>(0, 0);
  for (int i = 1; i <= n; i++) {
    {
      pair<long long, int> p = dp[i - 1];
      p.first += a[i];
      dp[i] = min(dp[i], p);
    }
    {
      pair<long long, int> p = dp[max(i - l, 0)];
      p.first -= x;
      p.second += 1;
      dp[i] = min(dp[i], p);
    }
  }
  return dp[n];
}
int solve() {
  if (cal(0).second <= k) return cal(0).first;
  int l = -n, r = n;
  int mid, ans;
  while (l <= r) {
    mid = (l + r) / 2;
    pair<long long, int> p = cal(mid);
    if (p.second <= k)
      l = mid + 1, ans = mid;
    else
      r = mid - 1;
  }
  pair<long long, int> p = cal(ans);
  return p.first + 1ll * ans * k;
}
int main() {
  scanf("%d%d%d", &n, &k, &l);
  scanf(" %s", s + 1);
  for (int i = 1; i <= n; i++) a[i] = s[i] >= 'a';
  int ans = n;
  for (int t = 0; t < 2; t++) {
    ans = min(ans, solve());
    for (int i = 1; i <= n; i++) a[i] ^= 1;
  }
  printf("%d\n", ans);
  return 0;
}
