func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 10;   int pref[N];   vector<int> v;   int fsoma(int l, int r) {     l--;     int ans = pref[r];     if (l >= 0) ans -= pref[l];     return ans;   }   long long n, k, l;   void rbest(pair<int, int> &a, pair<int, int> b) {     if (b.first > a.first or (a.first == b.first and b.second < a.second)) a = b;   }   pair<int, int> comb(pair<int, int> a, pair<int, int> b) {     return {a.first + b.first, a.second + b.second};   }   vector<pair<int, int>> dp(n);   pair<int, int> rec(int i) {     if (i >= 0) return dp[i];     return {0, 0};   }   pair<int, int> f(int c) {     dp = vector<pair<int, int>>(n);     for (int i = 0; i < n; i++) {       rbest(dp[i], rec(i - 1));       rbest(dp[i], comb(rec(i - l), {fsoma(i - (l - 1), i) - c, 1}));     }     return dp[n - 1];   }   long long solve(vector<int> &_v) {     v = _v;     for (int i = 0; i < (int)(v.size()); i++) {       pref[i] = v[i];       if (i) pref[i] += pref[i - 1];     }     int lo = 0, hi = l + 1;     while (lo < hi) {       int mid = (lo + hi) / 2;       if (f(mid).second <= k)         hi = mid;       else         lo = mid + 1;     }     auto par = f(lo);     return pref[(int)(v.size()) - 1] - (par.first + lo * k);   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n >> k >> l;     string s;     cin >> s;     vector<int> v1((int)(s.size())), v2((int)(s.size()));     for (int i = 0; i < (int)(s.size()); i++) {       if (s[i] >=  A  and s[i] <=  Z ) {         v1[i] = 1;       } else {         v2[i] = 1;       }     }     cout << min(solve(v1), solve(v2)) <<   n ;   }   