#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5, M = 20;   int n, m;   string s;   int pos[(1 << M) - 1], a[M + 5][M + 5], f[(1 << M) + 5], g[(1 << M) + 5][M + 5];   int main() {     memset(a, 0, sizeof(a));     memset(f, 0x3f, sizeof(f));     memset(g, 0, sizeof(g));     cin >> n >> m >> s;     for (int i = 0; i < n - 1; i++) {       a[s[i] -  a ][s[i + 1] -  a ]++;       a[s[i + 1] -  a ][s[i] -  a ]++;     }     for (int i = 0; i < m; i++) pos[1 << i] = i;     for (int i = 1; i < (1 << m); i++)       for (int j = 0; j < m; j++) {         int k = i & (-i);         g[i][j] = g[i ^ k][j] + a[j][pos[k]];       }     f[0] = 0;     for (int i = 0; i < (1 << m) - 1; i++) {       long long sum = 0;       for (int j = 0; j < m; j++)         if ((i & (1 << j)) == 0) sum += g[i][j];       for (int j = 0; j < m; j++)         if ((i & (1 << j)) == 0)           f[i | (1 << j)] = min(f[i] + sum, (long long)f[i | (1 << j)]);     }     cout << f[(1 << m) - 1];     return 0;   }   