func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k;   char playLog[1111];   char posLet[3] = { W ,  D ,  L };   int delta[3] = {1, 0, -1};   int val[256];   char dp[1111][2222];   void clearArray() {     for (int i = 0; i <= n + 1; i++) {       for (int j = -k; j <= k; j++) dp[i][j + k] =  X ;     }   }   void printAnswer() {     int currentState = 0;     for (int i = 0; i < n; i++) {       char thisOne = dp[i][currentState + k];       printf( %c , thisOne);       currentState += val[thisOne];     }     printf(  n );   }   int main() {     val[ W ] = 1;     val[ D ] = 0;     val[ L ] = -1;     scanf( %d%d , &n, &k);     scanf( %s , playLog);     clearArray();     dp[n][k + k] =  P ;     for (int i = n - 1; i >= 0; i--) {       for (int j = -(k - 1); j <= (k - 1); j++) {         for (int q = 0; q < 3; q++) {           if (playLog[i] !=  ?  && (playLog[i] != posLet[q])) continue;           int target = j + delta[q];           if (dp[i + 1][target + k] ==  X ) continue;           dp[i][j + k] = posLet[q];           break;         }       }     }     if (dp[0][0 + k] !=  X ) {       printAnswer();       return 0;     }     clearArray();     dp[n][0] =  P ;     for (int i = n - 1; i >= 0; i--) {       for (int j = -(k - 1); j <= (k - 1); j++) {         for (int q = 0; q < 3; q++) {           if (playLog[i] !=  ?  && (playLog[i] != posLet[q])) continue;           int target = j + delta[q];           if (dp[i + 1][target + k] ==  X ) continue;           dp[i][j + k] = posLet[q];           break;         }       }     }     if (dp[0][0 + k] !=  X ) {       printAnswer();       return 0;     }     printf( NO n );     return 0;   }   