func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n, k;     cin >> n >> k;     vector<pair<int, int> > v;     string a;     cin >> a;     int balance_max = 0;     int balance_min = 0;     v.push_back(pair<int, int>(0, 0));     for (int i = 0; i < n - 1; i++) {       if (a[i] ==  W ) {         balance_min++;         if (balance_max < k - 1) balance_max++;       } else if (a[i] ==  L ) {         balance_max--;         if (balance_min > 1 - k) balance_min--;       } else if (a[i] ==  ? ) {         if (balance_max < k - 1) balance_max++;         if (balance_min > 1 - k) balance_min--;       }       v.push_back(pair<int, int>(balance_min, balance_max));       if (balance_max < balance_min) {         cout <<  NO  << endl;         return 0;       }     }     if (a[n - 1] ==  W ) {       balance_min++;       balance_max++;     } else if (a[n - 1] ==  L ) {       balance_min--;       balance_max--;     } else if (a[n - 1] ==  ? ) {       balance_min--;       balance_max++;     }     v.push_back(pair<int, int>(balance_min, balance_max));     int pos = k;     string solve =   ;     if (balance_max == k) {       pos = k;     } else if (balance_min == -k) {       pos = -k;     } else {       cout <<  NO  << endl;       return 0;     }     for (int i = n - 1; i >= 0; i--) {       if (a[i] ==  L ) {         pos++;         solve +=  L ;       } else if (a[i] ==  W ) {         pos--;         solve +=  W ;       } else if (a[i] ==  D ) {         solve +=  D ;       } else if (a[i] ==  ? ) {         if (v[i].second < pos) {           pos--;           solve +=  W ;         } else if (v[i].first > pos) {           pos++;           solve +=  L ;         } else           solve +=  D ;       }     }     reverse(solve.begin(), solve.end());     cout << solve << endl;   }   