func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 100500;   int n, m;   char s[N];   int dp[N];   void solve() {     scanf( %d%d%s , &n, &m, s);     long long ans = (m - 1) * n;     for (int i = 0; i < n; i++) {       if (i - 1 >= 0 && s[i] != s[i - 1]) ans += (m - 1) * i;       if (i + 1 < n && s[i] != s[i + 1]) ans += (m - 1) * (n - 1 - i);     }     for (int i = 0; i < n; i++) {       dp[i] = 1;       if (i - 1 >= 0 && s[i - 1] != s[i]) dp[i] = 2;       if (i - 2 >= 0 && s[i - 1] != s[i] && s[i - 2] == s[i])         dp[i] = dp[i - 1] + 1;       ans -= dp[i] - 1;     }     printf( %lld n , ans);   }   int main() {     solve();     0;     return 0;   }   