func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k;   string a;   int b[10000];   int memo[2000][2000];   int dp(int i, int d) {     if (abs(d) == k && i == a.length()) return 0;     if (i == a.length() || abs(d) == k) return 1;     if (memo[i][d] != -1) return memo[i][d];     int x;     if (a[i] ==  L )       x = dp(i + 1, d - 1);     else if (a[i] ==  W )       x = dp(i + 1, d + 1);     else if (a[i] ==  D )       x = dp(i + 1, d);     else {       b[i] =  W  -  A ;       x = dp(i + 1, d + 1);       if (x == 1) {         b[i] =  L  -  A ;         x = dp(i + 1, d - 1);       }       if (x == 1) {         b[i] =  D  -  A ;         x = dp(i + 1, d);       }     }     return memo[i][d] = x;   }   int main() {     memset(memo, -1, sizeof(memo));     cin >> n >> k >> a;     if (dp(0, 0) == 1)       cout <<  NO ;     else {       for (int i = 0; i < a.length(); i++) {         if (a[i] !=  ? )           cout << a[i];         else           cout << (char)(b[i] +  A );       }     }     return 0;   }   