#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using pill = pair<int, ll>;
using vvi = vector<vi>;
ll gcd(ll a, ll b) {
  ll t;
  while ((t = a % b) != 0) {
    a = b;
    b = t;
  }
  return b;
}
ll fast_exp(ll base, ll n, ll m) {
  if (n == 0) return 1;
  ll t = fast_exp(base, n / 2, m);
  if (n % 2 == 0)
    return (t * t) % m;
  else
    return (((t * t) % m) * base) % m;
}
bool is_set(int i, ll mask) { return (mask >> i) & 1; }
int count_bits(ll mask) {
  int ans = 0;
  for (int i = 0; i < 64; ++i)
    if (is_set(i, mask)) ++ans;
  return ans;
}
int first_bit(ll mask) {
  int i = 0;
  while (i < 64)
    if (is_set(i++, mask)) return i - 1;
  return -1;
}
int const N = 5 * 1e5;
int const inf = 1e6;
int dp[N + 1][26];
int bt[N + 1][26];
void print_ans(int i, int j) {
  if (i == 0) return;
  print_ans(i - 1, bt[i][j]);
  cout << static_cast<char>('A' + j);
}
int main() {
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  s = " " + s;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < k; ++j) {
      dp[i][j] = inf;
      for (int l = 0; l < k; ++l) {
        if (l == j) continue;
        if (dp[i][j] > dp[i - 1][l] + 1)
          dp[i][j] = dp[i - 1][l] + 1, bt[i][j] = l;
      }
      if (s[i] == 'A' + j) dp[i][j]--;
    }
  }
  int ans = inf, lc = -1;
  for (int i = 0; i < k; ++i) {
    if (ans > dp[n][i]) ans = dp[n][i], lc = i;
  }
  cout << ans << "\n";
  print_ans(n, lc);
  cout << "\n";
  return 0;
}
