#include <bits/stdc++.h>
using namespace std;
double PI = 3.141592653589793238462643383279;
const double EPS = 1e-9;
const long long MOD = 1000000007;
const int inf = 1 << 30;
const long long linf = 1LL << 60;
long long n, k, l;
char buf[1000001];
string str;
bool b[1000001];
pair<long long, long long> dp[1000001];
pair<long long, long long> hoge(long long pen) {
  dp[0] = pair<long long, long long>(0, 0);
  for (int i = 1; i <= n; i++) {
    dp[i] = pair<long long, long long>(dp[i - 1].first + b[i - 1],
                                       dp[i - 1].second);
    dp[i] =
        min(dp[i], pair<long long, long long>(dp[max(0LL, i - l)].first + pen,
                                              dp[max(0LL, i - l)].second + 1));
  }
  return dp[n];
}
long long solve() {
  long long st = -1, en = n + 1;
  while (en - st > 1) {
    long long mid = (st + en) / 2;
    pair<long long, long long> p = hoge(mid);
    if (p.second <= k)
      en = mid;
    else
      st = mid;
  }
  pair<long long, long long> p = hoge(en);
  return p.first - k * en;
}
int main() {
  scanf("%lld%lld%lld", &n, &k, &l);
  scanf(" %s", buf);
  str = buf;
  for (int i = 0; i < (int)n; i++) {
    if ('a' <= str[i] && str[i] <= 'z')
      b[i] = true;
    else
      b[i] = false;
  }
  long long ans = solve();
  for (int i = 0; i < (int)n; i++) b[i] ^= 1;
  printf("%lld\n", min(ans, solve()));
}
