#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int maxn = 5e5 + 10;
int n, k;
int a[maxn], dp[maxn][30];
int to[maxn][30], to2[maxn][30];
string str;
int ans(int idx, int prev) {
  if (idx > n) return 0;
  if (dp[idx][prev] != -1) return dp[idx][prev];
  int ret = 1e9 + 7;
  for (int i = 1; i <= k; i++) {
    if (i == prev) continue;
    int now = ans(idx + 1, i) + (i != a[idx]);
    if (now < ret) {
      ret = now;
      to[idx][prev] = i;
      to2[idx][prev] = idx + 1;
    }
  }
  return dp[idx][prev] = ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  cin >> str;
  for (int i = 1; i <= n; i++) a[i] = str[i - 1] - 'A' + 1;
  memset(dp, -1, sizeof dp);
  cout << ans(1, 0) << endl;
  int p = to[1][0], q = to2[1][0], pp;
  char ch;
  while (p) {
    ch = p + 'A' - 1;
    cout << ch;
    if (q > n) break;
    pp = p;
    p = to[q][p];
    q = to2[q][pp];
  }
  return 0;
}
