#include <bits/stdc++.h>
using namespace std;
void boost() {
  cin.sync_with_stdio(0);
  cout.sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long k;
void change(char a, char b, char &c) {
  for (char i = 'A'; i <= 'Z'; i++) {
    if (i != a && i != b) {
      c = i;
      return;
    }
  }
}
int main() {
  boost();
  long long n;
  cin >> n >> k;
  string s;
  cin >> s;
  long long ans = 0;
  if (k == 2) {
    string s1;
    for (int i = 0; i < n; i++) {
      if (i % 2 == 0)
        s1 += 'A';
      else
        s1 += 'B';
    }
    string s2;
    for (int i = 0; i < n; i++) {
      if (i % 2 != 0)
        s2 += 'A';
      else
        s2 += 'B';
    }
    int diff1 = 0, diff2 = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] != s1[i]) diff1++;
      if (s[i] != s2[i]) diff2++;
    }
    if (diff1 < diff2) {
      cout << diff1 << "\n";
      cout << s1 << "\n";
    } else {
      cout << diff2 << "\n";
      cout << s2 << "\n";
    }
    return 0;
  }
  vector<pair<int, int> > single;
  for (int i = 0; i < n; i++) {
    int a = i, b = i;
    for (int j = i + 1; j < n; j++) {
      if (s[i] == s[j]) {
        b = j;
        if (j == n - 1) {
          i = j;
        }
      } else {
        i = j - 1;
        break;
      }
    }
    if (b > a) {
      single.emplace_back(a, b);
    }
  }
  for (int i = 0; i < single.size(); i++) {
    int sz = single[i].second - single[i].first + 1;
    int fir = single[i].first;
    int sec = single[i].second;
    if (sz % 2 != 0) {
      char to = (s[fir] == 'A' ? 'B' : 'A');
      for (int j = fir + 1; j < sec; j++) {
        s[j] = to;
        ++ans;
        ++j;
      }
    } else {
      if (sec < n - 1) {
        char to;
        for (char t = 'A'; t <= 'C'; t++) {
          if (t != s[fir] && t != s[sec + 1]) {
            to = t;
            break;
          }
        }
        for (int j = fir + 1; j <= sec; j++) {
          s[j] = to;
          ++ans;
          ++j;
        }
      } else {
        char to = (s[fir] == 'A' ? 'B' : 'A');
        for (int j = fir + 1; j <= sec; j++) {
          s[j] = to;
          ++ans;
          ++j;
        }
      }
    }
  }
  cout << ans << "\n";
  cout << s << "\n";
}
