#include <bits/stdc++.h>   #pragma GCC optimize( O3 )   using namespace std;   template <typename T>   inline void umax(T &a, T b) {     a = max(a, b);   }   template <typename T>   inline void umin(T &a, T b) {     a = min(a, b);   }   const long long N = 1e5 + 10;   const long long INF = 1e16 + 10;   const pair<long long, long long> NINF = make_pair(INF, INF);   const long double EPS = 1e-6;   const long long II = 1e9;   const long long MOD = 1e9 + 7;   long long dp[1 << 22];   long long cnt[50][50];   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n, m;     cin >> n >> m;     string second;     cin >> second;     for (long long i = 0; i < (n - 1); i++) {       cnt[second[i] -  a ][second[i + 1] -  a ]++;       cnt[second[i + 1] -  a ][second[i] -  a ]++;     }     for (long long i = 0; i < (1 << m); i++) dp[i] = INF;     for (long long i = 0; i < (m); i++) dp[1 << i] = 0;     for (long long msk = 0; msk < (1 << m); msk++) {       long long cur = dp[msk];       for (long long i = 0; i < (m); i++)         if (msk & (1 << i))           for (long long j = 0; j < (m); j++)             if ((msk & (1 << j)) == 0) cur += cnt[i][j];       for (long long j = 0; j < (m); j++)         if ((msk & (1 << j)) == 0) umin(dp[msk | (1 << j)], cur);     }     cout << dp[(1 << m) - 1];   }   