#include <bits/stdc++.h>
using namespace std;
long long qp(long long a, long long b, long long mod) {
  long long t = 1;
  while (b) {
    if (b & 1) t = t * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return t;
}
struct DOT {
  long long x;
  long long y;
};
inline void read(int &x) {
  int k = 0;
  char f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) k = k * 10 + c - '0';
  x = k * f;
}
const int dx[4] = {0, 0, -1, 1};
const int dy[4] = {1, -1, 0, 0};
const int inf = 0x3f3f3f3f;
const long long Linf = 0x3f3f3f3f3f3f3f3f;
const int maxn = 1e6 + 34;
struct NODE {
  int val;
  int cnt;
  friend bool operator<(NODE ax, NODE bx) {
    if (ax.val == bx.val) return ax.cnt < bx.cnt;
    return ax.val < bx.val;
  }
} dp[maxn];
NODE dp2[maxn];
char s[maxn];
int a[maxn];
int n, k, l;
int calc(int m) {
  memset(dp, 0x3f, sizeof dp);
  dp[0] = (NODE){0, 0};
  for (int i = 1; i <= n; i++) {
    dp[i] = (NODE){dp[i - 1].val + a[i], dp[i - 1].cnt};
    dp[i] = min(dp[i],
                (NODE){dp[max(0, i - l)].val + m, dp[max(0, i - l)].cnt + 1});
  }
  return dp[n].cnt;
}
int solve() {
  int lb = 0, rb = n, tmp = n;
  while (lb <= rb) {
    int m = lb + rb >> 1;
    if (calc(m) <= k) {
      rb = m - 1;
      tmp = min(tmp, m);
      memcpy(dp2, dp, sizeof dp);
    } else {
      lb = m + 1;
    }
  }
  return dp2[n].val - 1ll * tmp * k;
}
int main() {
  scanf("%d%d%d", &n, &k, &l);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) {
    if (s[i] >= 'a' && s[i] <= 'z') a[i] = 1;
  }
  int ans = inf;
  ans = min(ans, solve());
  for (int i = 1; i <= n; i++) a[i] = a[i] ^ 1;
  ans = min(ans, solve());
  printf("%d\n", ans);
}
