func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, k;   char s[1005], ans[1005];   map<long long, bool> dp[1005];   map<long long, char> pre[1005];   inline long long read() {     long long q = 0, f = 1;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) f = 0;       ch = getchar();     }     while (isdigit(ch)) q = (q << 3) + (q << 1) + (ch ^ 48), ch = getchar();     return f ? q : -q;   }   inline void print(long long x) {     if (x < 0) putchar( - ), x = -x;     if (x > 9) print(x / 10);     putchar(x % 10 + 48);   }   signed main() {     n = read(), k = read(), scanf( %s , s + 1), dp[1][0] = true;     for (long long i = 2; i <= n + 1; ++i)       for (long long j = -k + 1; j < k; ++j)         if (dp[i - 1][j]) {           if (!(s[i - 1] ^  L ))             pre[i][j - 1] =  L , dp[i][j - 1] = true;           else if (!(s[i - 1] ^  W ))             pre[i][j + 1] =  W , dp[i][j + 1] = true;           else if (!(s[i - 1] ^  D ))             pre[i][j] =  D , dp[i][j] = true;           else             pre[i][j + 1] =  W , pre[i][j] =  D , pre[i][j - 1] =  L ,                        dp[i][j + 1] = dp[i][j] = dp[i][j - 1] = true;         }     if (dp[n + 1][k] | dp[n + 1][-k]) {       long long j = dp[n + 1][k] ? k : -k;       for (long long i = n + 1; i > 1; --i) {         char ch = pre[i][j];         ans[i - 1] = ch, ((!(ch ^  W )) ? --j : ((!(ch ^  L )) ? ++j : i));       }       for (long long i = 1; i <= n; ++i) putchar(ans[i]);     } else {       putchar( N ), putchar( O );       return 0;     };     return 0;   }   