#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000000, inv2 = (MOD + 1) / 2;
long double eps = 1e-6;
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};
long double pi = acos(-1.0L);
pair<int, int> dp[1000000 + 10];
char s[1000000 + 10];
int a[1000000 + 10], n, k, l;
int read() {
  int v = 0, f = 1;
  char c = getchar();
  while (c < 48 || 57 < c) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar();
  return v * f;
}
long long readll() {
  long long v = 0, f = 1;
  char c = getchar();
  while (c < 48 || 57 < c) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar();
  return v * f;
}
int calc(int mid) {
  for (int i = (int)0; i <= (int)n; i++) dp[i] = make_pair(1e9, 1e9);
  dp[0] = make_pair(0, 0);
  for (int i = (int)0; i <= (int)n - 1; i++) {
    if (dp[i + 1] > make_pair(dp[i].first + a[i], dp[i].second))
      dp[i + 1] = make_pair(dp[i].first + a[i], dp[i].second);
    if (dp[min(n, i + l)] > make_pair(dp[i].first + mid, dp[i].second + 1))
      dp[min(n, i + l)] = make_pair(dp[i].first + mid, dp[i].second + 1);
  }
  return dp[n].second;
}
int solve() {
  int l = -n, r = n;
  int ans = 0;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (calc(mid) > k)
      l = mid + 1, ans = mid;
    else
      r = mid - 1;
  }
  if (calc(ans) <= k) return 0;
  calc(ans + 1);
  return dp[n].first - 1ll * (ans + 1) * k;
}
int main() {
  n = read(), k = read(), l = read();
  scanf("%s", s);
  for (int i = (int)0; i <= (int)n - 1; i++)
    if (s[i] >= 'a' && s[i] <= 'z') a[i] = 1;
  int ans = 1e9;
  ans = min(ans, solve());
  for (int i = (int)0; i <= (int)n - 1; i++) a[i] ^= 1;
  ans = min(ans, solve());
  printf("%d\n", ans);
  return 0;
}
