func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k;   int pr(int i) { return (i - 1 + n) % n; }   int nx(int i) { return (i + 1) % n; }   int get(int i, int j) {     if (i > j) swap(i, j);     return min(j - i, n - j + i);   }   char no(char el) {     if (el ==  B )       return  W ;     else       return  B ;   }   int gg(string s) {     int b = 1;     for (char i : s) {       if (i !=  B ) b = 0;     }     int w = 1;     for (char i : s) {       if (i !=  W ) w = 0;     }     return max(w, b);   }   signed main() {     string s;     cin >> n >> k >> s;     if (gg(s)) {       cout << s;       return 0;     }     vector<int> used(n, 0);     int l = 0, r = 0, op = 1e6;     bool ch = false;     while (l < n && op > 0) {       --op;       if (used[l]) {         ++l;       } else if (s[l] == s[pr(l)]) {         ch = true;         while (s[l] == s[nx(l)]) used[l] = 1, l = nx(l);         r = nx(l);         while (s[r] != s[nx(r)]) used[r] = 1, r = nx(r);         int cr = r;         while (s[nx(cr)] == s[cr]) used[cr] = 1, cr = nx(cr);         char last = s[l];         for (int i = nx(l); i != r; i = nx(i)) {           if (get(l, i) > k && get(r, i) > k)             s[i] = no(last), last = no(last);           else if (get(l, i) < get(r, i))             s[i] = s[l], last = s[l];           else if (get(l, i) >= get(r, i))             s[i] = s[r], last = s[r];         }         ++l;       } else {         ++l;       }     }     if (!ch) {       if (k % 2 == 0)         cout << s;       else         for (char i : s) cout << no(i);       return 0;     }     cout << s;   }   