func_code_string: #include <bits/stdc++.h>   using namespace std;   const int M = 21, N = 1e5 + 5, INF = 123456789;   int dp[(1 << M)], sum[(1 << M)][M];   int cnt[25][25], n, m;   char s[N];   int main() {     scanf( %d%d , &n, &m);     scanf( %s , (s + 1));     int len = strlen(s + 1);     for (int i = 2; i <= len; i++) {       cnt[s[i - 1] -  a  + 1][s[i] -  a  + 1]++;       cnt[s[i] -  a  + 1][s[i - 1] -  a  + 1]++;     }     for (int i = 1; i <= m; i++) cnt[i][i] = 0;     memset(dp, 0x7f, sizeof(dp));     dp[0] = 0;     for (int S = 0; S < (1 << m); S++) {       int summ = 0, T = (S ^ ((1 << m) - 1));       bool ex[M];       for (int x = 1; x <= m; x++) {         if (S & (1 << (x - 1))) {           ex[x] = 1;           summ++;         } else           ex[x] = 0;       }       for (int x = 1; x <= m; x++) {         if (ex[x]) continue;         int tmpsum = 0;         for (int y = 1; y <= m; y++) {           if (!ex[y]) {             tmpsum -= cnt[x][y];           }           if (ex[y]) {             tmpsum += cnt[x][y];           }         }         dp[S | (1 << (x - 1))] = min(1ll * dp[S | (1 << (x - 1))],                                      dp[S] + 1ll * (summ + 1) * (tmpsum));       }     }     printf( %d , dp[(1 << m) - 1]);   }   