#include <bits/stdc++.h>
using namespace std;
int abs(int x) {
  if (x < 0)
    return -x;
  else
    return x;
}
char allowed(char x, char y) {
  char first, second;
  if (x < y) {
    first = x;
    second = y;
  } else {
    first = y;
    second = x;
  }
  if (first == 'A' && second == 'B')
    return 'C';
  else if (first != 'A')
    return 'A';
  else
    return 'B';
}
int main() {
  int n, k;
  cin >> n >> k;
  char str[n + 1];
  cin >> str;
  if (k == 2) {
    int c1, c2;
    c1 = 0;
    c2 = 0;
    for (int i = 0; i < n; i++) {
      if (i % 2 == 0) {
        c1 += abs(int(str[i]) - int('A'));
        c2 += abs(int(str[i]) - int('B'));
      } else {
        c1 += abs(int(str[i]) - int('B'));
        c2 += abs(int(str[i]) - int('A'));
      }
    }
    if (c1 < c2) {
      cout << c1 << "\n";
      for (int i = 0; i < n; i++) {
        if (i % 2 == 0)
          cout << 'A';
        else
          cout << 'B';
      }
    } else {
      cout << c2 << "\n";
      for (int i = 0; i < n; i++) {
        if (i % 2 == 0)
          cout << 'B';
        else
          cout << 'A';
      }
    }
  } else {
    char dp[n + 1];
    int c = 0;
    dp[0] = str[0];
    for (int i = 1; i < n; i++) {
      if (str[i] == dp[i - 1]) {
        if (str[i - 1] != dp[i - 1]) {
          if (i > 1)
            dp[i - 1] = allowed(str[i], dp[i - 2]);
          else
            dp[i - 1] = allowed(str[i], str[i]);
          dp[i] = str[i];
        } else {
          dp[i] = allowed(str[i - 1], str[i - 1]);
          c += 1;
        }
      } else
        dp[i] = str[i];
    }
    cout << c << "\n";
    for (int i = 0; i < n; i++) cout << dp[i];
  }
  return 0;
}
