#include <bits/stdc++.h>
using namespace std;
void hinataVSsakura(void);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) hinataVSsakura();
  return 0;
}
struct jutsu {
  long long a, b, c;
};
bool jutsu_compare(jutsu s1, jutsu s2) {
  if (abs(s1.a - s2.a) >= abs(s1.b - s2.b))
    return s1.a > s2.a;
  else
    return s1.b < s2.b;
}
long long ncr(long long n, long long k) {
  long long res = 1;
  if (k > n - k) k = n - k;
  for (long long i = 0; i < k; ++i) {
    res *= (n - i);
    res /= (i + 1);
  }
  return res;
}
long long max(long long a, long long b) { return (a > b) ? a : b; }
long long min(long long a, long long b) { return (a < b) ? a : b; }
long long index(vector<long long> arr, long long val) {
  auto it = find((arr).begin(), (arr).end(), val);
  if (it != arr.end()) {
    long long ind = it - arr.begin();
    return ind;
  } else
    return -1;
}
void hinataVSsakura(void) {
  long long n, k;
  cin >> n >> k;
  string s, s1, s2;
  cin >> s;
  long long cnt = 0;
  if (k == 2) {
    for (long long i = 0; i < n; ++i) {
      if (i & 1) {
        s1 += 'A';
        s2 += 'B';
      } else {
        s1 += 'B';
        s2 += 'A';
      }
    }
    long long c1 = 0, c2 = 0;
    for (long long i = 0; i < n; ++i) {
      if (s[i] != s1[i]) c1++;
      if (s[i] != s2[i]) c2++;
    }
    if (c1 > c2) {
      cout << c2 << endl;
      cout << s2 << endl;
    } else {
      cout << c1 << endl;
      cout << s1 << endl;
    }
  } else {
    for (long long i = 1; i < n; ++i) {
      if (s[i] == s[i - 1]) {
        long long j = 0;
        while (j < k) {
          if ((i == n - 1) && ((j + 'A') != s[i - 1])) {
            cnt++;
            s[i] = j + 'A';
            break;
          } else if ((j + 'A' != s[i - 1]) && ((j + 'A') != s[i + 1])) {
            cnt++;
            s[i] = j + 'A';
            break;
          }
          j++;
        }
      }
    }
    cout << cnt << endl;
    cout << s << endl;
  }
}
