func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const double eps = 1e-9;   const int Mod = 1e9 + 7;   const int MaxN = 2e5 + 5;   char s[MaxN];   int a[MaxN];   int l[MaxN], r[MaxN];   bool cmp(int x, int y) { return x > y; }   int main() {     int n, k;     scanf( %d %d , &n, &k);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     scanf( %s , s + 1);     int len = 0;     for (int i = 1; i <= n; i++) {       if (i == 1) {         l[++len] = 1;         continue;       }       if (s[i] == s[i - 1]) continue;       r[len] = i - 1;       l[++len] = i;     }     r[len] = n;     for (int i = 1; i <= len; i++) {       sort(a + l[i], a + r[i] + 1, cmp);     }     long long ans = 0LL, cnt = 1;     for (int i = 1; i <= n; i++) {       if (s[i] == s[i - 1])         cnt++;       else         cnt = 1;       if (cnt > k) continue;       ans += (long long)a[i];     }     printf( %lld n , ans);     return 0;   }   