#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vii = vector<ii>;
const ll MOD = 998244353;
const int INF = 1e9 + 9;
const int MAXN = 2000006;
using pll = pair<ll, ll>;
int N, n, m, k, l, arr[MAXN];
pll dp[MAXN];
string s;
pll operator+(pll lhs, const pll& rhs) {
  lhs.first += rhs.first;
  lhs.second += rhs.second;
  return lhs;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k >> l;
  cin >> s;
  for (int i = 0; i < n; i++) {
    arr[i] = ('A' <= s[i] && s[i] <= 'Z');
  }
  ll ans1 = INF, ans2 = INF;
  int lo = -1, hi = n;
  while (lo + 1 < hi) {
    int med = (lo + hi) / 2;
    memset(dp, 0x7F, sizeof(dp));
    dp[0] = {0, 0};
    for (int i = 0; i < n; i++) {
      int j = min(i + l, n);
      dp[j] = min(dp[j], dp[i] + pll(med, 1));
      dp[i + 1] = min(dp[i + 1], dp[i] + pll(arr[i], 0));
    }
    if (dp[n].second <= k) {
      hi = med;
      ans1 = dp[n].first - med * k;
    } else {
      lo = med;
    }
  }
  lo = -1, hi = n;
  while (lo + 1 < hi) {
    int med = (lo + hi) / 2;
    memset(dp, 0x7F, sizeof(dp));
    dp[0] = {0, 0};
    for (int i = 0; i < n; i++) {
      int j = min(i + l, n);
      dp[j] = min(dp[j], dp[i] + pll(med, 1));
      dp[i + 1] = min(dp[i + 1], dp[i] + pll(arr[i] ^ 1, 0));
    }
    if (dp[n].second <= k) {
      hi = med;
      ans2 = dp[n].first - med * k;
    } else {
      lo = med;
    }
  }
  cout << min(ans1, ans2) << endl;
}
