#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Vi = vector<int>;
using Pii = pair<int, int>;
int uplg(int n) { return 32 - __builtin_clz(n); }
int uplg(ll n) { return 64 - __builtin_clzll(n); }
void run();
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(18);
  run();
  return 0;
}
vector<pair<ll, int>> dp;
pair<ll, int> paramSolve(const Vi& vec, int n, int l, ll cost) {
  dp.resize(n + 1);
  dp[0] = {0, 0};
  for (int pref = (1); pref < (n + 1); pref++) {
    dp[pref] = dp[pref - 1];
    dp[pref].first += vec[pref - 1];
    auto alt = (pref >= l ? dp[pref - l] : make_pair(0LL, 0));
    alt.first += cost;
    alt.second++;
    dp[pref] = min(dp[pref], alt);
  }
  return dp.back();
}
int solve(const Vi& vec, int n, int k, int l) {
  ll begin = 0, end = 1e7;
  while (begin + 1 < end) {
    ll mid = (begin + end) / 2;
    auto tmp = paramSolve(vec, n, l, mid);
    if (tmp.second >= k) {
      begin = mid;
    } else {
      end = mid;
    }
  }
  while (1) {
    auto tmp = paramSolve(vec, n, l, begin);
    if (tmp.second <= k) {
      return int(tmp.first - begin * k);
    }
    begin++;
  }
}
void run() {
  int n, k, l;
  cin >> n >> k >> l;
  string s;
  cin >> s;
  Vi vec;
  for (auto& c : (s)) vec.push_back(c >= 'A' && c <= 'Z');
  int ans = solve(vec, n, k, l);
  for (auto& e : (vec)) e = !e;
  ans = min(ans, solve(vec, n, k, l));
  cout << ans << endl;
}
