func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   bool umin(T& a, T b) {     if (a > b) {       a = b;       return 1;     }     return 0;   }   template <class T>   bool umax(T& a, T b) {     if (a < b) {       a = b;       return 1;     }     return 0;   }   const int N = 1e2 + 9;   char s[N], t[N];   int dp[N][N], sz, n, k, par[N], pw[N];   pair<int, int> way[N][N];   int mod(long long x) {     while (x < 0) x += 1000000007;     return (x % 1000000007);   }   int get(int x, int y) {     if (x > y) return 0;     return mod(par[y] - mod(par[x - 1] * 1LL * pw[y - x + 1]));   }   int rec(int x, int y) {     if (x > sz) {       if (t[x - sz] ==  1  and y != sz) return 0;       if (t[x - sz] ==  0  and y == sz) return 0;     }     if (x > n) return 1;     int& ret = dp[x][y];     if (~ret) return ret;     ret = 0;     for (int i = 0; i < k; i++) {       int len = 0;       for (int j = min(y + 1, sz); j >= 1; j--)         if (mod(get(y - j + 2, y) * 27LL + i + 1) == par[j]) {           len = j;           break;         }       if (rec(x + 1, len)) {         way[x][y] = make_pair(i, len);         return ret = 1;       }     }     return 0;   }   int main() {     memset(dp, -1, sizeof dp);     scanf( %d%d , &n, &k);     scanf( %s , s + 1);     sz = strlen(s + 1);     pw[0] = 1;     for (int i = 1; i <= sz; i++) {       par[i] = mod(par[i - 1] * 27LL + (s[i] -  a  + 1));       pw[i] = mod(pw[i - 1] * 27LL);     }     scanf( %s , t + 1);     if (!rec(1, 0)) return 0 * puts( No solution );     int now = 0;     for (int i = 1; i <= n; i++) {       printf( %c , char(way[i][now].first + 97));       now = way[i][now].second;     }     return 0;   }   