#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  string s, s1 = "", s2 = "";
  cin >> s;
  if (k == 2) {
    long long cnt = 0, cnt1 = 0, cnt2 = 0;
    for (long long i = 0; i < n; i++) {
      s1 += (cnt % 2 == 0 ? "A" : "B");
      s2 += (cnt % 2 == 0 ? "B" : "A");
      cnt++;
      cnt1 += (s1[i] != s[i] ? 1 : 0);
      cnt2 += (s2[i] != s[i] ? 1 : 0);
    }
    cout << min(cnt1, cnt2) << endl;
    if (cnt1 > cnt2)
      cout << s2;
    else
      cout << s1;
  } else {
    long long cnt = 1;
    vector<long long> v;
    char prev;
    for (long long i = 0; i < n; i++) {
      if (i == 0)
        prev = s[i];
      else if (prev == s[i])
        cnt++;
      else {
        v.push_back(cnt);
        cnt = 1;
        prev = s[i];
      }
    }
    v.push_back(cnt);
    long long j = 0, ans = 0;
    for (long long i = 0; i < v.size(); i++) {
      long long x = v[i];
      if (x % 2 == 0) {
        long long y = s[j] - 'A';
        char use;
        if (j == 0) {
          if (y == 0)
            use = 'B';
          else
            use = 'A';
        } else {
          if ((y == 0 && s[j - 1] - 'A' == 1) ||
              (s[j - 1] - 'A' == 0 && y == 1))
            use = 'C';
          else if (y == 0 || (s[j - 1] - 'A' == 0))
            use = 'B';
          else
            use = 'A';
        }
        for (long long l = j; l < j + x; l += 2) {
          s[l] = use;
          ans++;
        }
        j += x;
      } else {
        if (x == 1) {
          j++;
        } else {
          char c = s[j], use;
          if (c == 'A')
            use = 'B';
          else
            use = 'A';
          for (long long l = j + 1; l < j + x; l += 2) {
            s[l] = use;
            ans++;
          }
          j += x;
        }
      }
    }
    cout << ans << endl;
    cout << s;
  }
}
