func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 1 << 30;   const int Mod = 1000000007;   char s[1010];   bool dp[1010][2 * 1010][3];   int v[1010];   int pre[1010][2 * 1010][3];   char ch[4];   int main() {     int n, m;     ch[0] =  W , ch[1] =  L , ch[2] =  D ;     scanf( %d %d %s , &n, &m, s + 1);     dp[0][1010][0] = dp[0][1010][1] = dp[0][1010][2] = true;     for (int i = 0; i < n; ++i) {       for (int j = 1010 - i; j <= 1010 + i; ++j) {         if (abs(j - 1010) >= m) continue;         for (int t = 0; t < 3; ++t) {           if (!dp[i][j][t]) continue;           if (s[i + 1] ==  W ) {             dp[i + 1][j + 1][0] = true;             pre[i + 1][j + 1][0] = t;           } else if (s[i + 1] ==  L ) {             dp[i + 1][j - 1][1] = true;             pre[i + 1][j - 1][1] = t;           } else if (s[i + 1] ==  D ) {             dp[i + 1][j][2] = true;             pre[i + 1][j][2] = t;           } else {             dp[i + 1][j + 1][0] = true;             pre[i + 1][j + 1][0] = t;             dp[i + 1][j - 1][1] = true;             pre[i + 1][j - 1][1] = t;             dp[i + 1][j][2] = true;             pre[i + 1][j][2] = t;           }         }       }     }     bool flag = false;     for (int k = 0; k <= 2 && !flag; ++k) {       if (dp[n][1010 + m][k]) {         flag = true;         int y = 1010 + m, z = k;         for (int i = n; i >= 1; --i) {           s[i] = ch[z];           int zz = z;           z = pre[i][y][z];           if (zz == 0) y--;           if (zz == 1) y++;         }         printf( %s n , s + 1);       }     }     for (int k = 0; k <= 2 && !flag; ++k) {       if (dp[n][1010 - m][k]) {         flag = true;         int y = 1010 - m, z = k;         for (int i = n; i >= 1; --i) {           s[i] = ch[z];           int zz = z;           z = pre[i][y][z];           if (zz == 0) y--;           if (zz == 1) y++;         }         printf( %s n , s + 1);       }     }     if (!flag) puts( NO );     return 0;   }   