func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   int mode, t;   const int INF = 1e9 + 7;   void solve() {     int n, k;     cin >> n >> k;     string s;     cin >> s;     int rot = 0;     if (s[0] == s[n - 1]) {       int start = -1;       for (int i = 0; i < n - 1; i++) {         if (s[i] != s[i + 1]) {           start = i + 1;           break;         }       }       if (start < 0) {         cout << s << endl;         return;       }       rotate(s.begin(), s.begin() + start, s.end());       rot = start;     }     vector<int> sizes;     char prev = s[0];     int size = 0;     for (char c : s) {       if (c == prev) {         size++;       } else {         sizes.push_back(size);         prev = c;         size = 1;       }     }     sizes.push_back(size);     int groups = sizes.size();     vector<int> dist(groups, INF);     for (int i = 0; i < 2 * groups; i++) {       if (sizes[i % groups] > 1) {         dist[i % groups] = 0;       } else {         dist[i % groups] =             min(dist[i % groups], 1 + dist[(i - 1 + groups) % groups]);       }     }     for (int i = 2 * groups - 1; i >= 0; i--) {       dist[i % groups] =           min(dist[i % groups], 1 + dist[(i + 1 + groups) % groups]);     }     vector<char> answer(n);     int i = 0;     char curr = s[0];     for (int group_no = 0; group_no < groups; group_no++) {       if (sizes[group_no] > 1) {         for (int rep = 0; rep < sizes[group_no]; rep++) {           answer[i] = curr;           i++;         }       } else {         if (k <= dist[group_no]) {           if (k % 2) {             answer[i] =  B  +  W  - curr;           } else {             answer[i] = curr;           }         } else {           if (dist[group_no] % 2) {             answer[i] =  B  +  W  - curr;           } else {             answer[i] = curr;           }         }         i++;       }       curr =  B  +  W  - curr;     }     rotate(answer.begin(), answer.begin() + n - rot, answer.end());     for (char c : answer) {       cout << c;     }     cout << endl;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     mode = 0;     if (mode == 0) {       solve();     } else {       cin >> t;       while (t--) {         solve();       }     }   }   