#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1000000000;
const ll LINF = 1001002003004005006ll;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
struct IOSetup {
  IOSetup() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(12);
  }
} iosetup;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < (int)v.size(); i++)
    os << v[i] << (i + 1 == (int)v.size() ? "" : " ");
  return os;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &x : v) is >> x;
  return is;
}
int solve(vector<int> v, int l, int k) {
  using P = pair<ll, ll>;
  int n = (int)v.size();
  auto f = [&](ll pena) {
    vector<P> dp(n + 1, P(-LINF, 0));
    dp[0] = P(0, 0);
    for (int i = 0; i < (n); i++) {
      int nxt = min(i + l, n);
      chmax(dp[nxt], P(dp[i].first + (nxt - i) - pena, dp[i].second + 1));
      chmax(dp[i + 1], P(dp[i].first + v[i], dp[i].second));
    }
    return dp[n];
  };
  ll lw = 0, hi = INF, pena = 0;
  while (lw <= hi) {
    ll m = (lw + hi) / 2;
    P x = f(m);
    if (x.second >= k) {
      pena = m;
      lw = m + 1;
    } else {
      hi = m - 1;
    }
  }
  auto ans = f(pena);
  ll ret = n - (ans.first + pena * (ll)(k));
  return ret;
}
void ECR79F() {
  int n, k, l;
  cin >> n >> k >> l;
  string s;
  cin >> s;
  vector<int> v(n);
  for (int i = 0; i < (n); i++) v[i] = ('a' <= s[i] and s[i] <= 'z');
  int res = INF;
  chmin(res, solve(v, l, k));
  for (auto &x : v) x ^= 1;
  chmin(res, solve(v, l, k));
  cout << res << endl;
}
signed main() {
  ECR79F();
  return 0;
}
