//{

#include <bits/stdc++.h>

#define all(x) x.begin (), x.end ()
#define rall(x) x.rbegin (), x.rend ()

#define LOCAL

using namespace std;

using lli = long long;
using ld = long double;

mt19937 rnd (time (nullptr));

//}

char GetColor (char c1, char c2)
{
    for (char c = 'A'; c <= 'Z'; c++)
        if ((c1 != c) && (c2 != c))
            return c;
    assert (false);
    return 0;
}

inline void Solve ()
{
    int n = 0, k = 0;
    cin >> n >> k;
    string s;
    cin >> s;
    if (k == 2)
    {
        int cnt1 = 0, cnt2 = 0;
        for (int i = 0; i < n; i++)
        {
            if (i % 2 == 0)
            {
                if (s[i] != 'A')
                    cnt1++;
                else
                    cnt2++;
            }
            else
            {
                if (s[i] != 'A')
                    cnt2++;
                else
                    cnt1++;
            }
        }
        if (cnt1 < cnt2)
        {
            cout << cnt1 << '\n';
            for (int i = 0; i < n; i++)
            {
                if (i % 2 == 0)
                    cout << 'A';
                else
                    cout << 'B';
            }
        }
        else
        {
            cout << cnt2 << '\n';
            for (int i = 0; i < n; i++)
            {
                if (i % 2 == 0)
                    cout << 'B';
                else
                    cout << 'A';
            }
        }
        return;
    }
    vector <pair <char, int>> blocks;
    blocks.push_back ({ s[0], 1 });
    for (int i = 1; i < n; i++)
    {
        if (s[i] == s[i - 1])
            blocks.back ().second++;
        else
        {
            blocks.push_back ({ s[i], 1 });
        }
    }
    int result = 0;
    for (auto it : blocks)
        result += it.second / 2;
    cout << result << '\n';
    if (blocks.size () == 1)
    {
        char tmp = 0;
        if (blocks[0].first != 'A')
            tmp = 'A';
        else
            tmp = 'B';
        for (int j = 0; j < blocks[0].second; j++)
        {
            if (j % 2 == 0)
                cout << blocks[0].first;
            else
                cout << tmp;
        }
        return;
    }
    string answer;
    char tmp = GetColor (blocks[0].first, blocks[1].first);
    for (int j = 0; j < blocks[0].second; j++)
    {
        if (j % 2 == 0)
            answer.push_back (blocks[0].first);
        else
            answer.push_back (tmp);
    }
    for (int i = 1; i + 1 < blocks.size (); i++)
    {
        if (answer.back () != blocks[i + 1].first)
        {
            for (int j = 0; j < blocks[i].second; j++)
            {
                if (j % 2 == 0)
                    answer.push_back (blocks[i + 1].first);
                else
                    answer.push_back (blocks[i].first);
            }
        }
        else
        {
            char tmp1 = GetColor (answer.back (), blocks[i].first);
            for (int j = 0; j < blocks[i].second; j++)
            {
                if (j % 2 == 0)
                    answer.push_back (blocks[i].first);
                else
                    answer.push_back (tmp1);
            }
        }
    }
    tmp = GetColor (answer.back (), blocks[blocks.size () - 1].first);
    for (int j = 0; j < blocks.back ().second; j++)
    {
        if (j % 2 == 0)
            answer.push_back (blocks.back ().first);
        else
            answer.push_back (tmp);
    }
    cout << answer;
}

signed main ()
{
#ifndef LOCAL
    ios_base::sync_with_stdio (false);
    cin.tie (nullptr);
    cout.tie (nullptr);
#endif
    cout << fixed << setprecision (20);
    Solve ();
    return 0;
}


//{

#include <bits/stdc++.h>

#define all(x) x.begin (), x.end ()
#define rall(x) x.rbegin (), x.rend ()

#define LOCAL

using namespace std;

using lli = long long;
using ld = long double;

mt19937 rnd (time (nullptr));

//}

char GetColor (char c1, char c2)
{
    for (char c = 'A'; c <= 'Z'; c++)
        if ((c1 != c) && (c2 != c))
            return c;
    assert (false);
    return 0;
}

inline void Solve ()
{
    int n = 0, k = 0;
    cin >> n >> k;
    string s;
    cin >> s;
    if (k == 2)
    {
        int cnt1 = 0, cnt2 = 0;
        for (int i = 0; i < n; i++)
        {
            if (i % 2 == 0)
            {
                if (s[i] != 'A')
                    cnt1++;
                else
                    cnt2++;
            }
            else
            {
                if (s[i] != 'A')
                    cnt2++;
                else
                    cnt1++;
            }
        }
        if (cnt1 < cnt2)
        {
            cout << cnt1 << '\n';
            for (int i = 0; i < n; i++)
            {
                if (i % 2 == 0)
                    cout << 'A';
                else
                    cout << 'B';
            }
        }
        else
        {
            cout << cnt2 << '\n';
            for (int i = 0; i < n; i++)
            {
                if (i % 2 == 0)
                    cout << 'B';
                else
                    cout << 'A';
            }
        }
        return;
    }
    vector <pair <char, int>> blocks;
    blocks.push_back ({ s[0], 1 });
    for (int i = 1; i < n; i++)
    {
        if (s[i] == s[i - 1])
            blocks.back ().second++;
        else
        {
            blocks.push_back ({ s[i], 1 });
        }
    }
    int result = 0;
    for (auto it : blocks)
        result += it.second / 2;
    cout << result << '\n';
    if (blocks.size () == 1)
    {
        char tmp = 0;
        if (blocks[0].first != 'A')
            tmp = 'A';
        else
            tmp = 'B';
        for (int j = 0; j < blocks[0].second; j++)
        {
            if (j % 2 == 0)
                cout << blocks[0].first;
            else
                cout << tmp;
        }
        return;
    }
    string answer;
    char tmp = GetColor (blocks[0].first, blocks[1].first);
    for (int j = 0; j < blocks[0].second; j++)
    {
        if (blocks[0].second % 2 == 0)
        {
            if (j % 2 == 1)
                answer.push_back (blocks[0].first);
            else
                answer.push_back (tmp);
        }
        else
        {
            if (j % 2 == 0)
                answer.push_back (blocks[0].first);
            else
                answer.push_back (tmp);
        }
    }
    for (int i = 1; i + 1 < blocks.size (); i++)
    {
        if (answer.back () != blocks[i + 1].first)
        {
            for (int j = 0; j < blocks[i].second; j++)
            {
                if (blocks[i].second % 2 == 0)
                {
                    if (j % 2 == 0)
                        answer.push_back (blocks[i + 1].first);
                    else
                        answer.push_back (blocks[i].first);
                }
                else
                {
                    if (j % 2 == 1)
                        answer.push_back (blocks[i + 1].first);
                    else
                        answer.push_back (blocks[i].first);
                }
            }
        }
        else
        {
            char tmp1 = GetColor (answer.back (), blocks[i].first);
            for (int j = 0; j < blocks[i].second; j++)
            {
                if (blocks[i].second % 2 == 0)
                {
                    if (j % 2 == 0)
                        answer.push_back (blocks[i].first);
                    else
                        answer.push_back (tmp1);
                }
                else
                {
                    if (j % 2 == 1)
                        answer.push_back (blocks[i].first);
                    else
                        answer.push_back (tmp1);
                }
            }
        }
    }
    tmp = GetColor (answer.back (), blocks[blocks.size () - 1].first);
    for (int j = 0; j < blocks.back ().second; j++)
    {
        if (blocks.back ().second % 2 == 0)
        {
            if (j % 2 == 1)
                answer.push_back (blocks.back ().first);
            else
                answer.push_back (tmp);
        }
        else
        {
            if (j % 2 == 0)
                answer.push_back (blocks.back ().first);
            else
                answer.push_back (tmp);
        }
    }
    cout << answer;
}

signed main ()
{
#ifndef LOCAL
    ios_base::sync_with_stdio (false);
    cin.tie (nullptr);
    cout.tie (nullptr);
#endif
    cout << fixed << setprecision (20);
    Solve ();
    return 0;
}


// Author :mastermindevil/mdragneell
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second

ll const mod=1e9+7;
ll const N=5e5+5;
ll fact[N];
ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return (y>0?y:1); else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x)%mod;y>>=1;if(y<=0)break;x=(x*x)%mod;}return res;}
ll factorial () { fact[0]=1; fact[1]=1; for(int i=2;i<N;i++) fact[i]=(fact[i-1]*i)%mod;}ll

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);}
};
struct compare {
    bool operator()(const pair<ll, ll>& value,  const ll& key){ return (value.first < key); }
    bool operator()(const ll& key, const pair<ll, ll>& value) { return (key < value.first); }
};

bool compare1(const pair<ll,ll> &a,const pair<ll,ll> &b)
{   if(a.s>b.s) return true ;
    else if(a.s==b.s) return (a.f < b.f);
    else return false;
}

ll dp[N][27];
ll n,k;
string v;
ll sol(ll pos,ll last)
{
    if(pos>=n)
        return 0;
    ll &ans=dp[pos][last];
    if(ans!=-1) return ans;
    ans=1e9;

    for(int i=1;i<=k;i++)
    {
        if(last!=i){
            ans=min(sol(pos+1,i)+(v[pos]!=(i-1+'A')),ans);
        }

    }
    return ans;

}
string s;
void paths(ll pos,ll last)
{
    if(pos>=n) return ;
    ll ans=1e9,pp=-1;

    for(int i=1;i<=k;i++)
    {
        if(last!=i)
        {
            if(ans>sol(pos+1,i)+(v[pos]!=(i-1+'A')))
            {
                ans=sol(pos+1,i)+(v[pos]!=(i-1+'A'));
                pp=i;
            }
        }
    }
    s+=(pp-1+'A');
    paths(pos+1,pp);
}

int main()
{

        ios_base::sync_with_stdio(false); cin.tie(NULL);

        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif

        int tt=1;
        //cin>>tt;

        while(tt--)
        {

            cin>>n>>k>>v;

            memset(dp,-1,sizeof(dp));

            cout<<sol(0,0)<<endl;

            paths(0,0);
            cout<<s<<endl;

        }

}


// Author :mastermindevil/mdragneell
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second

ll const mod=1e9+7;
ll const N=1e5+5;
ll fact[N];
ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return (y>0?y:1); else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x)%mod;y>>=1;if(y<=0)break;x=(x*x)%mod;}return res;}
ll factorial () { fact[0]=1; fact[1]=1; for(int i=2;i<N;i++) fact[i]=(fact[i-1]*i)%mod;}ll

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);}
};
struct compare {
    bool operator()(const pair<ll, ll>& value,  const ll& key){ return (value.first < key); }
    bool operator()(const ll& key, const pair<ll, ll>& value) { return (key < value.first); }
};

bool compare1(const pair<ll,ll> &a,const pair<ll,ll> &b)
{   if(a.s>b.s) return true ;
    else if(a.s==b.s) return (a.f < b.f);
    else return false;
}

int main()
{

        ios_base::sync_with_stdio(false); cin.tie(NULL);

        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif

        int tt=1;
        //cin>>tt;

        while(tt--)
        {
            ll n,k;
            string s;
            cin>>n>>k>>s;
            ll ans=0;

            for(int i=1;i<n;i++)
            {
                if(i<n-1 && s[i]==s[i+1] && s[i]==s[i-1])
                {
                    s[i]=s[i-1]+1;
                    if(s[i-1]-'A'==k-1){
                        s[i]='A';

                    }
                    ans++;
                }

                else if(s[i]==s[i-1])
                {
                    if(i<n-1)
                    {
                        for(int j=0;j<k;j++)
                        {
                            if(s[i-1]!=(j+'A') && s[i+1]!=(j+'A'));{
                                s[i]=j+'A';
                                ans++;
                                break;
                            }
                        }
                    }
                    else if(i>1){
                        s[i]=s[i-2];
                        ans++;
                    }

                }
            }

            cout<<ans<<endl<<s<<endl;

        }

}


// Author :mastermindevil/mdragneell
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second

ll const mod=1e9+7;
ll const N=5e5+5;
ll fact[N];
ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return (y>0?y:1); else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x)%mod;y>>=1;if(y<=0)break;x=(x*x)%mod;}return res;}
ll factorial () { fact[0]=1; fact[1]=1; for(int i=2;i<N;i++) fact[i]=(fact[i-1]*i)%mod;}ll

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);}
};
struct compare {
    bool operator()(const pair<ll, ll>& value,  const ll& key){ return (value.first < key); }
    bool operator()(const ll& key, const pair<ll, ll>& value) { return (key < value.first); }
};

bool compare1(const pair<ll,ll> &a,const pair<ll,ll> &b)
{   if(a.s>b.s) return true ;
    else if(a.s==b.s) return (a.f < b.f);
    else return false;
}

ll dp[N][27];
ll n,k;
string v;
ll sol(ll pos,ll last)
{
    if(pos>=n)
        return 0;
    ll &ans=dp[pos][last];
    if(ans!=-1) return ans;
    ans=1e9;

    for(int i=1;i<=k;i++)
    {
        if(last!=i){
            ans=min(sol(pos+1,i)+(v[pos]!=(i-1+'A')),ans);
        }

    }
    return ans;

}
string s;
void paths(ll pos,ll last)
{
    if(pos>=n) return ;
    ll ans=1e9,pp=-1;

    ans=dp[pos][last];

    for(int i=1;i<=k;i++)
    {
        if(last!=i)
        {
            if(ans-((v[pos]-'A')!=i-1)==dp[pos+1][i])
            {
                pp=i;
                break;
            }
        }
    }
    s+=(pp-1+'A');
    paths(pos+1,pp);
}

int main()
{

        ios_base::sync_with_stdio(false); cin.tie(NULL);

        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif

        int tt=1;
        //cin>>tt;

        while(tt--)
        {

            cin>>n>>k>>v;

            for(int i=0;i<=n;i++){
                for(int j=0;j<=k;j++){
                    dp[i][j]=-1;
                    if(i==n)
                        dp[i][j]=0;
                }
            }

            cout<<sol(0,0)<<endl;

            paths(0,0);
            cout<<s<<endl;

        }

}


// Author :mastermindevil/mdragneell
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second

ll const mod=1e9+7;
ll const N=1e5+5;
ll fact[N];
ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return (y>0?y:1); else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x)%mod;y>>=1;if(y<=0)break;x=(x*x)%mod;}return res;}
ll factorial () { fact[0]=1; fact[1]=1; for(int i=2;i<N;i++) fact[i]=(fact[i-1]*i)%mod;}ll

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);}
};
struct compare {
    bool operator()(const pair<ll, ll>& value,  const ll& key){ return (value.first < key); }
    bool operator()(const ll& key, const pair<ll, ll>& value) { return (key < value.first); }
};

bool compare1(const pair<ll,ll> &a,const pair<ll,ll> &b)
{   if(a.s>b.s) return true ;
    else if(a.s==b.s) return (a.f < b.f);
    else return false;
}

int main()
{

        ios_base::sync_with_stdio(false); cin.tie(NULL);

        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif

        int tt=1;
        //cin>>tt;

        while(tt--)
        {
            ll n,k;
            string s;
            cin>>n>>k>>s;
            ll ans=0;

            for(int i=1;i<n;i++)
            {

                if(s[i]==s[i-1])
                {
                    if(i<n-1)
                    {
                        ll f=0;
                        for(int j=0;j<k;j++)
                        {

                            if(s[i-1]!=(j+'A') &&  i+1<n && s[i+1]!=(j+'A')){
                                s[i]=j+'A';
                                ans++;
                                f=1;
                                break;
                            }

                        }
                        if(!f) {
                            s[i-1]=s[i+1];
                            ans++;
                        }

                    }
                    else if(i>=1){

                        if(i>1 && n>2)
                            s[i]=s[i-2];
                        else
                        {
                            s[i]=s[i-1]+1;
                            if(s[i-1]=='A'+k-1)
                                s[i]='A';
                        }
                        ans++;
                    }

                }
            }

            cout<<ans<<endl<<s<<endl;

        }

}


// Author :mastermindevil/mdragneell
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second

ll const mod=1e9+7;
ll const N=1e5+5;
ll fact[N];
ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return (y>0?y:1); else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x)%mod;y>>=1;if(y<=0)break;x=(x*x)%mod;}return res;}
ll factorial () { fact[0]=1; fact[1]=1; for(int i=2;i<N;i++) fact[i]=(fact[i-1]*i)%mod;}ll

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);}
};
struct compare {
    bool operator()(const pair<ll, ll>& value,  const ll& key){ return (value.first < key); }
    bool operator()(const ll& key, const pair<ll, ll>& value) { return (key < value.first); }
};

bool compare1(const pair<ll,ll> &a,const pair<ll,ll> &b)
{   if(a.s>b.s) return true ;
    else if(a.s==b.s) return (a.f < b.f);
    else return false;
}

int main()
{

        ios_base::sync_with_stdio(false); cin.tie(NULL);

        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif

        int tt=1;
        //cin>>tt;

        while(tt--)
        {
            ll n,k;
            string s;
            cin>>n>>k>>s;
            ll ans=0;

            for(int i=1;i<n;i++)
            {

                if(s[i]==s[i-1])
                {
                    if(i<n-1)
                    {
                        for(int j=0;j<k;j++)
                        {

                            if(s[i-1]!=(j+'A') && s[i+1]!=(j+'A')){
                                s[i]=j+'A';
                                //cout<<j<<" "<<i<<" "<<s<<endl;
                                ans++;
                                break;
                            }

                        }
                    }
                    else if(i>1){
                        s[i]=s[i-2];
                        ans++;
                    }

                }
            }

            cout<<ans<<endl<<s<<endl;

        }

}


// Author :mastermindevil/mdragneell
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second

ll const mod=1e9+7;
ll const N=1e5+5;
ll fact[N];
ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return (y>0?y:1); else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x)%mod;y>>=1;if(y<=0)break;x=(x*x)%mod;}return res;}
ll factorial () { fact[0]=1; fact[1]=1; for(int i=2;i<N;i++) fact[i]=(fact[i-1]*i)%mod;}ll

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);}
};
struct compare {
    bool operator()(const pair<ll, ll>& value,  const ll& key){ return (value.first < key); }
    bool operator()(const ll& key, const pair<ll, ll>& value) { return (key < value.first); }
};

bool compare1(const pair<ll,ll> &a,const pair<ll,ll> &b)
{   if(a.s>b.s) return true ;
    else if(a.s==b.s) return (a.f < b.f);
    else return false;
}

int main()
{

        ios_base::sync_with_stdio(false); cin.tie(NULL);

        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif

        int tt=1;
        //cin>>tt;

        while(tt--)
        {
            ll n,k;
            string s;
            cin>>n>>k>>s;
            ll ans=0;

            for(int i=1;i<n;i++)
            {

                if(s[i]==s[i-1])
                {
                    if(i<n-1)
                    {
                        ll f=0;
                        for(int j=0;j<k;j++)
                        {

                            if(s[i-1]!=(j+'A') &&  i+1<n && s[i+1]!=(j+'A')){
                                s[i]=j+'A';
                                ans++;
                                f=1;
                                break;
                            }

                        }
                        if(!f) {
                            s[i-1]=s[i+1];
                            ans++;
                        }

                    }
                    else if(i>1){

                        if(n>2)
                            s[i]=s[i-2];
                        else
                        {
                            s[i]=s[i-1]+1;
                            if(s[i-1]=='A'+k-1)
                                s[i]='A';
                        }
                        ans++;
                    }

                }
            }

            cout<<ans<<endl<<s<<endl;

        }

}


// Author :mastermindevil/mdragneell
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second

ll const mod=1e9+7;
ll const N=1e5+5;
ll fact[N];
ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return (y>0?y:1); else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x)%mod;y>>=1;if(y<=0)break;x=(x*x)%mod;}return res;}
ll factorial () { fact[0]=1; fact[1]=1; for(int i=2;i<N;i++) fact[i]=(fact[i-1]*i)%mod;}ll

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);}
};
struct compare {
    bool operator()(const pair<ll, ll>& value,  const ll& key){ return (value.first < key); }
    bool operator()(const ll& key, const pair<ll, ll>& value) { return (key < value.first); }
};

bool compare1(const pair<ll,ll> &a,const pair<ll,ll> &b)
{   if(a.s>b.s) return true ;
    else if(a.s==b.s) return (a.f < b.f);
    else return false;
}

int main()
{

        ios_base::sync_with_stdio(false); cin.tie(NULL);

        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif

        int tt=1;
        //cin>>tt;

        while(tt--)
        {
            ll n,k;
            string s;
            cin>>n>>k>>s;
            ll ans=0;

            for(int i=1;i<n;i++)
            {

                if(s[i]==s[i-1])
                {
                    if(i<n-1)
                    {
                        for(int j=0;j<k;j++)
                        {

                            if(s[i-1]!=(j+'A') &&  i+1<n && s[i+1]!=(j+'A')){
                                s[i]=j+'A';
                                ans++;
                                break;
                            }

                        }

                    }
                    else if(i>1){
                        s[i]=s[i-2];
                        ans++;
                    }

                    else
                    {
                        s[i]=s[i-1]+1;
                        if(s[i-1]=='A'+k-1)
                            s[i]='A';
                        ans++;
                    }

                }
            }

            cout<<ans<<endl<<s<<endl;

        }

}


// Author :mastermindevil/mdragneell
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second

ll const mod=1e9+7;
ll const N=5e5+5;
ll fact[N];
ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return (y>0?y:1); else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x)%mod;y>>=1;if(y<=0)break;x=(x*x)%mod;}return res;}
ll factorial () { fact[0]=1; fact[1]=1; for(int i=2;i<N;i++) fact[i]=(fact[i-1]*i)%mod;}ll

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);}
};
struct compare {
    bool operator()(const pair<ll, ll>& value,  const ll& key){ return (value.first < key); }
    bool operator()(const ll& key, const pair<ll, ll>& value) { return (key < value.first); }
};

bool compare1(const pair<ll,ll> &a,const pair<ll,ll> &b)
{   if(a.s>b.s) return true ;
    else if(a.s==b.s) return (a.f < b.f);
    else return false;
}

ll dp[N][27];
ll n,k;
string v;
ll sol(ll pos,ll last)
{
    if(pos>=n)
        return 0;
    ll &ans=dp[pos][last];
    if(ans!=-1) return ans;
    ans=1e9;

    for(int i=1;i<=k;i++)
    {
        if(last!=i){
            ans=min(sol(pos+1,i)+(v[pos]!=(i-1+'A')),ans);
        }

    }
    return ans;

}
string s;
void paths(ll pos,ll last)
{
    if(pos>=n) return ;
    ll ans=1e9,pp=-1;

    ans=dp[pos][last];

    for(int i=1;i<=k;i++)
    {
        if(last!=i)
        {
            if(ans-((v[pos]-'A')!=i-1)==sol(pos+1,i))
            {
                pp=i;
                break;
            }
        }
    }
    s+=(pp-1+'A');
    paths(pos+1,pp);
}

int main()
{

        ios_base::sync_with_stdio(false); cin.tie(NULL);

        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif

        int tt=1;
        //cin>>tt;

        while(tt--)
        {

            cin>>n>>k>>v;

            memset(dp,-1,sizeof(dp));

            cout<<sol(0,0)<<endl;

            paths(0,0);
            cout<<s<<endl;

        }

}


// Author :mastermindevil/mdragneell
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second

ll const mod=1e9+7;
ll const N=5e5+5;
ll fact[N];
ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return (y>0?y:1); else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x)%mod;y>>=1;if(y<=0)break;x=(x*x)%mod;}return res;}
ll factorial () { fact[0]=1; fact[1]=1; for(int i=2;i<N;i++) fact[i]=(fact[i-1]*i)%mod;}ll

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);}
};
struct compare {
    bool operator()(const pair<ll, ll>& value,  const ll& key){ return (value.first < key); }
    bool operator()(const ll& key, const pair<ll, ll>& value) { return (key < value.first); }
};

bool compare1(const pair<ll,ll> &a,const pair<ll,ll> &b)
{   if(a.s>b.s) return true ;
    else if(a.s==b.s) return (a.f < b.f);
    else return false;
}

int dp[N][27];
int n,k;
string v;
int sol(int pos,int last)
{
    if(pos>=n)
        return 0;
    int &ans=dp[pos][last];
    if(ans!=-1) return ans;
    ans=1e7;

    for(int i=1;i<=k;i++)
    {
        if(last!=i){
            ans=min(sol(pos+1,i)+(v[pos]!=(i-1+'A')),ans);
        }

    }
    return ans;

}
string s;
void paths(ll pos,int last)
{
    if(pos>=n) return ;
    ll ans=1e9,pp=-1;

    ans=dp[pos][last];

    for(int i=1;i<=k;i++)
    {
        if(last!=i)
        {
            if(ans-((v[pos]-'A')!=i-1)==dp[pos+1][i])
            {
                pp=i;
                break;
            }
        }
    }
    s+=(pp-1+'A');
    paths(pos+1,pp);
}

int main()
{

        ios_base::sync_with_stdio(false); cin.tie(NULL);

        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif

        int tt=1;
        //cin>>tt;

        while(tt--)
        {

            cin>>n>>k>>v;

            for(int i=0;i<=n;i++){
                for(int j=0;j<=k;j++){
                    dp[i][j]=-1;
                    if(i==n)
                        dp[i][j]=0;
                }
            }

            cout<<sol(0,0)<<'\n';

            paths(0,0);
            cout<<s<<'\n';

        }

}


// Author :mastermindevil/mdragneell
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second

ll const mod=1e9+7;
ll const N=5e5+5;
ll fact[N];
ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return (y>0?y:1); else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x)%mod;y>>=1;if(y<=0)break;x=(x*x)%mod;}return res;}
ll factorial () { fact[0]=1; fact[1]=1; for(int i=2;i<N;i++) fact[i]=(fact[i-1]*i)%mod;}ll

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);}
};
struct compare {
    bool operator()(const pair<ll, ll>& value,  const ll& key){ return (value.first < key); }
    bool operator()(const ll& key, const pair<ll, ll>& value) { return (key < value.first); }
};

bool compare1(const pair<ll,ll> &a,const pair<ll,ll> &b)
{   if(a.s>b.s) return true ;
    else if(a.s==b.s) return (a.f < b.f);
    else return false;
}

ll dp[N][27];
ll n,k;
string v;
ll sol(ll pos,ll last)
{
    if(pos>=n)
        return 0;
    ll &ans=dp[pos][last];
    if(ans!=-1) return ans;
    ans=1e9;

    for(int i=1;i<=k;i++)
    {
        if(last!=i){
            ans=min(sol(pos+1,i)+(v[pos]!=(i-1+'A')),ans);
        }

    }
    return ans;

}
string s;
void paths(ll pos,ll last)
{
    if(pos>=n) return ;
    ll ans=1e9,pp=-1;

    ans=dp[pos][last];

    for(int i=1;i<=k;i++)
    {
        if(last!=i)
        {
            if(ans-((v[pos]-'A')!=i-1)==dp[pos+1][i])
            {
                pp=i;
                break;
            }
        }
    }
    s+=(pp-1+'A');
    paths(pos+1,pp);
}

int main()
{

        ios_base::sync_with_stdio(false); cin.tie(NULL);

        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif

        int tt=1;
        //cin>>tt;

        while(tt--)
        {

            cin>>n>>k>>v;

            for(int i=0;i<=n;i++)
                for(int j=0;j<=k;j++)
                    dp[i][j]=-1;
            cout<<sol(0,0)<<endl;

            paths(0,0);
            cout<<s<<endl;

        }

}


// Author :mastermindevil/mdragneell
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second

ll const mod=1e9+7;
ll const N=1e5+5;
ll fact[N];
ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return (y>0?y:1); else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x)%mod;y>>=1;if(y<=0)break;x=(x*x)%mod;}return res;}
ll factorial () { fact[0]=1; fact[1]=1; for(int i=2;i<N;i++) fact[i]=(fact[i-1]*i)%mod;}ll

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);}
};
struct compare {
    bool operator()(const pair<ll, ll>& value,  const ll& key){ return (value.first < key); }
    bool operator()(const ll& key, const pair<ll, ll>& value) { return (key < value.first); }
};

bool compare1(const pair<ll,ll> &a,const pair<ll,ll> &b)
{   if(a.s>b.s) return true ;
    else if(a.s==b.s) return (a.f < b.f);
    else return false;
}

ll dp[N][27];
ll n,k;
string v;
ll sol(ll pos,ll last)
{
    if(pos>=n)
        return 0;
    ll &ans=dp[pos][last];
    if(ans!=-1) return ans;
    ans=1e9;

    for(int i=1;i<=k;i++)
    {
        if(last!=i){
            ans=min(sol(pos+1,i)+(v[pos]!=(i-1+'A')),ans);
        }

    }
    return ans;

}
string s;
void paths(ll pos,ll last)
{
    if(pos>=n) return ;
    ll ans=1e9,pp=-1;

    for(int i=1;i<=k;i++)
    {
        if(last!=i)
        {
            if(ans>sol(pos+1,i)+(v[pos]!=(i-1+'A')))
            {
                ans=sol(pos+1,i)+(v[pos]!=(i-1+'A'));
                pp=i;
            }
        }
    }
    s+=(pp-1+'A');
    paths(pos+1,pp);
}

int main()
{

        ios_base::sync_with_stdio(false); cin.tie(NULL);

        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif

        int tt=1;
        //cin>>tt;

        while(tt--)
        {

            cin>>n>>k>>v;

            memset(dp,-1,sizeof(dp));

            cout<<sol(0,0)<<endl;

            paths(0,0);
            cout<<s<<endl;

        }

}


// Author :mdragneell/mastermindevil
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second

ll const mod=1e9+7;
ll const N=5e5+5;
ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return y; else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x)%mod;y>>=1;if(y<=0)break;x=(x*x)%mod;}return res;}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);}
};
struct compare {
    bool operator()(const pair<ll, ll>& value,  const ll& key){ return (value.first < key); }
    bool operator()(const ll& key, const pair<ll, ll>& value) { return (key < value.first); }
};

bool compare1(const pair<ll,ll> &a,const pair<ll,ll> &b)
{   if(a.first<b.first) return true ;
    else if(a.first==b.first) return (a.second > b.second);
    else return false;
}

string s;
ll dp[N][27];
vector<char>v(N);
ll n,k;
void paths(ll pos ,ll last)
{
    if(pos<1) return ;
    ll ans=1e9,pp=-1;

    for(int i=1;i<=k;i++)
    {
        if(i!=last)
            if(ans>dp[pos][i])
            {
                ans=dp[pos][i];
                pp=i;
            }
    }
    //cout<<ans<<endl;
    s+=(pp-1+'A');
    paths(pos-1,pp);
}

int main()
{

        ios_base::sync_with_stdio(false); cin.tie(NULL);

        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif

        int tt=1;
        //cin>>tt;

        while(tt--)
        {

            cin>>n>>k;
            for(int i=0;i<n;i++){
                cin>>v[i];
            }

            for(int i=0;i<=n;i++){
                for(int j=0;j<=30;j++){
                    dp[i][j]=1e7;

                    if(i==0)
                        dp[i][j]=0;
                }

            }

            for(int i=1;i<=n;i++)
            {
                for(int j=1;j<=k;j++)
                {
                    for(int l=1;l<=k;l++)
                    {
                        if(l!=j){
                            if(v[i-1]-'A'!=l-1 )
                                dp[i][l]=min(dp[i-1][j]+1,dp[i][l]);
                            else
                                dp[i][l]=min(dp[i-1][j],dp[i][l]);
                        }
                    }
                }
            }
            ll ans=1e9;
            for(int j=0;j<=k;j++)
                    ans=min(ans,dp[n][j]);
            paths(n,0);
            reverse(s.begin(),s.end());

            cout<<ans<<endl<<s<<endl;

        }

}


// Author :mastermindevil/mdragneell
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second

ll const mod=1e9+7;
ll const N=5e5+5;
ll fact[N];
ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return (y>0?y:1); else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x)%mod;y>>=1;if(y<=0)break;x=(x*x)%mod;}return res;}
ll factorial () { fact[0]=1; fact[1]=1; for(int i=2;i<N;i++) fact[i]=(fact[i-1]*i)%mod;}ll

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);}
};
struct compare {
    bool operator()(const pair<ll, ll>& value,  const ll& key){ return (value.first < key); }
    bool operator()(const ll& key, const pair<ll, ll>& value) { return (key < value.first); }
};

bool compare1(const pair<ll,ll> &a,const pair<ll,ll> &b)
{   if(a.s>b.s) return true ;
    else if(a.s==b.s) return (a.f < b.f);
    else return false;
}

ll dp[N][27];
ll n,k;
string v;
ll sol(ll pos,ll last)
{
    if(pos>=n)
        return 0;
    ll &ans=dp[pos][last];
    if(ans!=-1) return ans;
    ans=1e9;

    for(int i=1;i<=k;i++)
    {
        if(last!=i){
            ans=min(sol(pos+1,i)+(v[pos]!=(i-1+'A')),ans);
        }

    }
    return ans;

}
string s;
void paths(ll pos,ll last)
{
    if(pos>=n) return ;
    ll ans=1e9,pp=-1;

    ans=dp[pos][last];

    for(int i=1;i<=k;i++)
    {
        if(last!=i)
        {
            if(ans-((v[pos]-'A')!=i-1)==sol(pos+1,i))
            {
                pp=i;
                break;
            }
        }
    }
    s+=(pp-1+'A');
    paths(pos+1,pp);
}

int main()
{

        ios_base::sync_with_stdio(false); cin.tie(NULL);

        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif

        int tt=1;
        //cin>>tt;

        while(tt--)
        {

            cin>>n>>k>>v;

            for(int i=0;i<=n;i++)
                for(int j=0;j<=k;j++)
                    dp[i][j]=-1;
            cout<<sol(0,0)<<endl;

            paths(0,0);
            cout<<s<<endl;

        }

}


// Author :mastermindevil/mdragneell
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define pi  pair< int,int >
#define pl  pair< ll,ll >
#define f first
#define s second

ll const mod=1e9+7;
ll const N=1e5+5;
ll fact[N];
ll min(ll x,ll y) { if(x < y) return x; else return y; }
ll max(ll x,ll y) { if(x > y) return x; else return y; }
ll gcd(ll x,ll y) { if(x == 0) return (y>0?y:1); else return gcd(y%x,x);}
ll powmod(ll x,ll y){ll res=1;while(y>0){if(y%2==1)res=(res*x)%mod;y>>=1;if(y<=0)break;x=(x*x)%mod;}return res;}
ll factorial () { fact[0]=1; fact[1]=1; for(int i=2;i<N;i++) fact[i]=(fact[i-1]*i)%mod;}ll

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);}
};
struct compare {
    bool operator()(const pair<ll, ll>& value,  const ll& key){ return (value.first < key); }
    bool operator()(const ll& key, const pair<ll, ll>& value) { return (key < value.first); }
};

bool compare1(const pair<ll,ll> &a,const pair<ll,ll> &b)
{   if(a.s>b.s) return true ;
    else if(a.s==b.s) return (a.f < b.f);
    else return false;
}

int main()
{

        ios_base::sync_with_stdio(false); cin.tie(NULL);

        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        #endif

        int tt=1;
        //cin>>tt;

        while(tt--)
        {
            ll n,k;
            string s;
            cin>>n>>k>>s;
            ll ans=0;

            for(int i=1;i<n;i++)
            {
                if(i<n-1 && s[i]==s[i+1] && s[i]==s[i-1])
                {
                    s[i]=s[i-1]+1;
                    if(s[i-1]=='Z'){
                        s[i]='A';

                    }
                    ans++;
                }

                else if(s[i]==s[i-1])
                {
                    if(i<n-1)
                    {
                        for(int j=0;j<k;j++)
                        {
                            if(s[i-1]!=(i+'A') && s[i+1]!=(i+'A'));{
                                s[i]=i+'A';
                                ans++;
                                break;
                            }
                        }
                    }
                    else if(i>1){
                        s[i]=s[i-2];
                        ans++;
                    }

                }
            }

            cout<<ans<<endl<<s<<endl;

        }

}


//****************************Bismillahir Rahmanir Rahim***************************//

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define rt return

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

/*
bool seive[1010000];
vi prime;

void seiveGen(int limit) {
    limit += 100;
    int sqrtn = sqrt(limit);
    for(int i = 3; i <= sqrtn; i += 2) {
            if(!seive[i>>1]) {
                    for(int j = i * i; j < limit; j += i + i) {
                            seive[j>>1] = 1;
                    }
            }
    }
    prime.PB(2);
    for(int i = 3; i < limit; i += 2) {
            if(!seive[i>>1]) prime.PB(i);
    }
}
*/
/*
*******************************USE of STL***************************
v.erase(unique(v.begin(),v.end()),v.end());
    int a[]={..........};
    sort(a,a+n,greater<int>()); ///sort in descending order
    int z=sizeof(a)/sizeof(a[0]); ///size of array
    string s,x;
    transform(s.begin(),s.end(),s.begin(),::tolower);///change of uppercase to lowercase of any string
    int i;
    i=s.compare(x); ///compare two string like strcmp
    int n,m;
    i=log10(n)+1; ///how many digits in integer n
    i=abs(n-m); ///take absolute value
     copy(v.begin(),v.end(),back_inserter(q)); ///copying v vector to q
     s.find("AB"); ///search index Number of AB(substring) in string s
     remove(a,a+n,3); ///delete 3rd element from array
     ceil(2.3) /// Returns the smallest integer that is greater than or equal to x (i.e : rounds up the nearest integer) দশমিক যদি <=.৫ হয় তাহলে একযোগ করে প্রিন্ট করবে
     round(2.3)///return round value...like 2.3=2,,,2.5=3,,2.6=3;

     {
         ///int to string transfer///
         ostringstream temp; ///need a temp;
         int x;
         temp<<x;
         string s;
         s=temp.str(x); ///transfer
     }
     count(s.begin(), s.end(), 'a')///Count the number of occurrences of 'a' in a string s
*/

//
//debug
#ifdef ahasun
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif
//****************Source Code starting From here**************//

int main()
{
	string s,t;
	t="ABC";
	int n,k,ans=0;
	cin>>n>>k>>s;
	for(int i=1;i<n;i++)
	{
		if(s[i]==s[i-1])
		{
			char ch;
			int x=0;
			for(int j=0;j<3;j++)
			{
				if(s[i-1]!=t[j] && s[i+1]!=t[j] && x==0)
				{
					ch=t[j];
					x=1;
				}
			}
			if(x==1)
			{
				s[i]=ch;
				ans++;
			}
		}
	}
	cout<<ans<<endl<<s;
	//rt main();
}


//****************************Bismillahir Rahmanir Rahim***************************//

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define rt return

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

/*
bool seive[1010000];
vi prime;

void seiveGen(int limit) {
    limit += 100;
    int sqrtn = sqrt(limit);
    for(int i = 3; i <= sqrtn; i += 2) {
            if(!seive[i>>1]) {
                    for(int j = i * i; j < limit; j += i + i) {
                            seive[j>>1] = 1;
                    }
            }
    }
    prime.PB(2);
    for(int i = 3; i < limit; i += 2) {
            if(!seive[i>>1]) prime.PB(i);
    }
}
*/
/*
*******************************USE of STL***************************
v.erase(unique(v.begin(),v.end()),v.end());
    int a[]={..........};
    sort(a,a+n,greater<int>()); ///sort in descending order
    int z=sizeof(a)/sizeof(a[0]); ///size of array
    string s,x;
    transform(s.begin(),s.end(),s.begin(),::tolower);///change of uppercase to lowercase of any string
    int i;
    i=s.compare(x); ///compare two string like strcmp
    int n,m;
    i=log10(n)+1; ///how many digits in integer n
    i=abs(n-m); ///take absolute value
     copy(v.begin(),v.end(),back_inserter(q)); ///copying v vector to q
     s.find("AB"); ///search index Number of AB(substring) in string s
     remove(a,a+n,3); ///delete 3rd element from array
     ceil(2.3) /// Returns the smallest integer that is greater than or equal to x (i.e : rounds up the nearest integer) দশমিক যদি <=.৫ হয় তাহলে একযোগ করে প্রিন্ট করবে
     round(2.3)///return round value...like 2.3=2,,,2.5=3,,2.6=3;

     {
         ///int to string transfer///
         ostringstream temp; ///need a temp;
         int x;
         temp<<x;
         string s;
         s=temp.str(x); ///transfer
     }
     count(s.begin(), s.end(), 'a')///Count the number of occurrences of 'a' in a string s
*/

//
//debug
#ifdef ahasun
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif
//****************Source Code starting From here**************//

int main()
{
	string s,t;
	t="ABC";
	int n,k,ans=0,l=t.length();
	cin>>n>>k>>s;
	if(k==2)
		l--;
	if(k==2)
	{
		string p,q;
		for(int i=0;i<=n/2;i++)
		{
			p+="AB";
			q+="BA";
		}
		int x=0,y=0;
		for(int i=0;i<n;i++)
		{
			if(s[i]!=p[i])
				x++;
			if(s[i]!=q[i])
				y++;
		}
		ans=min(x,y);
	}
	if(k!=2){
	for(int i=1;i<n;i++)
	{
		int z=0,x=0;
		if(s[i]==s[i-1])
		{
			z=1;
			char ch;
			//int x=0;
			for(int j=0;j<l;j++)
			{
				if(s[i-1]!=t[j] && s[i+1]!=t[j] && x==0)
				{
					ch=t[j];
					x=1;
				}
			}
			if(x==1)
			{
				s[i]=ch;
				ans++;
			}
		}
		if(z==1 && x==0)
		{
			char ch;
			for(int j=0;j<l;j++)
			{
				if(s[i-1]!=t[j] && s[i-2]!=t[j] && x==0)
				{
					ch=t[j];
					x=1;
				}
			}
			if(x==1)
			{
				s[i-1]=ch;
				ans++;
			}
		}
	}}
	cout<<ans<<endl<<s<<endl;;
	//rt main();
}


//****************************Bismillahir Rahmanir Rahim***************************//

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define rt return

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

/*
bool seive[1010000];
vi prime;

void seiveGen(int limit) {
    limit += 100;
    int sqrtn = sqrt(limit);
    for(int i = 3; i <= sqrtn; i += 2) {
            if(!seive[i>>1]) {
                    for(int j = i * i; j < limit; j += i + i) {
                            seive[j>>1] = 1;
                    }
            }
    }
    prime.PB(2);
    for(int i = 3; i < limit; i += 2) {
            if(!seive[i>>1]) prime.PB(i);
    }
}
*/
/*
*******************************USE of STL***************************
v.erase(unique(v.begin(),v.end()),v.end());
    int a[]={..........};
    sort(a,a+n,greater<int>()); ///sort in descending order
    int z=sizeof(a)/sizeof(a[0]); ///size of array
    string s,x;
    transform(s.begin(),s.end(),s.begin(),::tolower);///change of uppercase to lowercase of any string
    int i;
    i=s.compare(x); ///compare two string like strcmp
    int n,m;
    i=log10(n)+1; ///how many digits in integer n
    i=abs(n-m); ///take absolute value
     copy(v.begin(),v.end(),back_inserter(q)); ///copying v vector to q
     s.find("AB"); ///search index Number of AB(substring) in string s
     remove(a,a+n,3); ///delete 3rd element from array
     ceil(2.3) /// Returns the smallest integer that is greater than or equal to x (i.e : rounds up the nearest integer) দশমিক যদি <=.৫ হয় তাহলে একযোগ করে প্রিন্ট করবে
     round(2.3)///return round value...like 2.3=2,,,2.5=3,,2.6=3;

     {
         ///int to string transfer///
         ostringstream temp; ///need a temp;
         int x;
         temp<<x;
         string s;
         s=temp.str(x); ///transfer
     }
     count(s.begin(), s.end(), 'a')///Count the number of occurrences of 'a' in a string s
*/

//
//debug
#ifdef ahasun
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif
//****************Source Code starting From here**************//

int main()
{
	string s,t;
	t="ABC";
	int n,k,ans=0,l=t.length();
	cin>>n>>k>>s;
	if(k==2)
		l--;
	if(k==2)
	{
		string p,q;
		for(int i=0;i<=n/2;i++)
		{
			p+="AB";
			q+="BA";
		}
		int x=0,y=0;
		for(int i=0;i<n;i++)
		{
			if(s[i]!=p[i])
				x++;
			if(s[i]!=q[i])
				y++;
		}
		if(x<y)
		{
			ans=x;
			s=p;
		}
		else
		{
			ans=y;
			s=q;
		}
	}
	if(k!=2){
	for(int i=1;i<n;i++)
	{
		int z=0,x=0;
		if(s[i]==s[i-1])
		{
			z=1;
			char ch;
			//int x=0;
			for(int j=0;j<l;j++)
			{
				if(s[i-1]!=t[j] && s[i+1]!=t[j] && x==0)
				{
					ch=t[j];
					x=1;
				}
			}
			if(x==1)
			{
				s[i]=ch;
				ans++;
			}
		}
	}}
	cout<<ans<<endl;
	for(int i=0;i<n;i++)
		cout<<s[i];
	//rt main();
}


//****************************Bismillahir Rahmanir Rahim***************************//

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define rt return

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

/*
bool seive[1010000];
vi prime;

void seiveGen(int limit) {
    limit += 100;
    int sqrtn = sqrt(limit);
    for(int i = 3; i <= sqrtn; i += 2) {
            if(!seive[i>>1]) {
                    for(int j = i * i; j < limit; j += i + i) {
                            seive[j>>1] = 1;
                    }
            }
    }
    prime.PB(2);
    for(int i = 3; i < limit; i += 2) {
            if(!seive[i>>1]) prime.PB(i);
    }
}
*/
/*
*******************************USE of STL***************************
v.erase(unique(v.begin(),v.end()),v.end());
    int a[]={..........};
    sort(a,a+n,greater<int>()); ///sort in descending order
    int z=sizeof(a)/sizeof(a[0]); ///size of array
    string s,x;
    transform(s.begin(),s.end(),s.begin(),::tolower);///change of uppercase to lowercase of any string
    int i;
    i=s.compare(x); ///compare two string like strcmp
    int n,m;
    i=log10(n)+1; ///how many digits in integer n
    i=abs(n-m); ///take absolute value
     copy(v.begin(),v.end(),back_inserter(q)); ///copying v vector to q
     s.find("AB"); ///search index Number of AB(substring) in string s
     remove(a,a+n,3); ///delete 3rd element from array
     ceil(2.3) /// Returns the smallest integer that is greater than or equal to x (i.e : rounds up the nearest integer) দশমিক যদি <=.৫ হয় তাহলে একযোগ করে প্রিন্ট করবে
     round(2.3)///return round value...like 2.3=2,,,2.5=3,,2.6=3;

     {
         ///int to string transfer///
         ostringstream temp; ///need a temp;
         int x;
         temp<<x;
         string s;
         s=temp.str(x); ///transfer
     }
     count(s.begin(), s.end(), 'a')///Count the number of occurrences of 'a' in a string s
*/

//
//debug
#ifdef ahasun
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif
//****************Source Code starting From here**************//

int main()
{
	string s,t;
	t="ABC";
	int n,k,ans=0,l=t.length();
	cin>>n>>k>>s;
	if(k==2)
		l--;
	for(int i=1;i<n;i++)
	{
		int z=0,x=0;
		if(s[i]==s[i-1])
		{
			z=1;
			char ch;
			//int x=0;
			for(int j=0;j<l;j++)
			{
				if(s[i-1]!=t[j] && s[i+1]!=t[j] && x==0)
				{
					ch=t[j];
					x=1;
				}
			}
			if(x==1)
			{
				s[i]=ch;
				ans++;
			}
		}
		if(z==1 && x==0)
		{
			char ch;
			for(int j=0;j<l;j++)
			{
				if(s[i-1]!=t[j] && s[i-2]!=t[j] && x==0)
				{
					ch=t[j];
					x=1;
				}
			}
			if(x==1)
			{
				s[i]=ch;
				ans++;
			}
		}
	}
	cout<<ans<<endl<<s<<endl;;
	//rt main();
}


//****************************Bismillahir Rahmanir Rahim***************************//

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define rt return

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

/*
bool seive[1010000];
vi prime;

void seiveGen(int limit) {
    limit += 100;
    int sqrtn = sqrt(limit);
    for(int i = 3; i <= sqrtn; i += 2) {
            if(!seive[i>>1]) {
                    for(int j = i * i; j < limit; j += i + i) {
                            seive[j>>1] = 1;
                    }
            }
    }
    prime.PB(2);
    for(int i = 3; i < limit; i += 2) {
            if(!seive[i>>1]) prime.PB(i);
    }
}
*/
/*
*******************************USE of STL***************************
v.erase(unique(v.begin(),v.end()),v.end());
    int a[]={..........};
    sort(a,a+n,greater<int>()); ///sort in descending order
    int z=sizeof(a)/sizeof(a[0]); ///size of array
    string s,x;
    transform(s.begin(),s.end(),s.begin(),::tolower);///change of uppercase to lowercase of any string
    int i;
    i=s.compare(x); ///compare two string like strcmp
    int n,m;
    i=log10(n)+1; ///how many digits in integer n
    i=abs(n-m); ///take absolute value
     copy(v.begin(),v.end(),back_inserter(q)); ///copying v vector to q
     s.find("AB"); ///search index Number of AB(substring) in string s
     remove(a,a+n,3); ///delete 3rd element from array
     ceil(2.3) /// Returns the smallest integer that is greater than or equal to x (i.e : rounds up the nearest integer) দশমিক যদি <=.৫ হয় তাহলে একযোগ করে প্রিন্ট করবে
     round(2.3)///return round value...like 2.3=2,,,2.5=3,,2.6=3;

     {
         ///int to string transfer///
         ostringstream temp; ///need a temp;
         int x;
         temp<<x;
         string s;
         s=temp.str(x); ///transfer
     }
     count(s.begin(), s.end(), 'a')///Count the number of occurrences of 'a' in a string s
*/

//
//debug
#ifdef ahasun
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif
//****************Source Code starting From here**************//

int main()
{
	string s,t;
	t="ABC";
	int n,k,ans=0;
	cin>>n>>k>>s;
	for(int i=1;i<n;i++)
	{
		if(s[i]==s[i-1])
		{
			char ch;
			int x=0;
			for(int j=0;j<3;j++)
			{
				if(s[i-1]!=t[j] && s[i+1]!=t[j] && x==0)
				{
					ch=t[j];
					x=1;
				}
			}
			if(x==1)
			{
				s[i]=ch;
				ans++;
			}
		}
	}
	cout<<ans<<endl;
	//rt main();
}


//****************************Bismillahir Rahmanir Rahim***************************//

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define rt return

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

/*
bool seive[1010000];
vi prime;

void seiveGen(int limit) {
    limit += 100;
    int sqrtn = sqrt(limit);
    for(int i = 3; i <= sqrtn; i += 2) {
            if(!seive[i>>1]) {
                    for(int j = i * i; j < limit; j += i + i) {
                            seive[j>>1] = 1;
                    }
            }
    }
    prime.PB(2);
    for(int i = 3; i < limit; i += 2) {
            if(!seive[i>>1]) prime.PB(i);
    }
}
*/
/*
*******************************USE of STL***************************
v.erase(unique(v.begin(),v.end()),v.end());
    int a[]={..........};
    sort(a,a+n,greater<int>()); ///sort in descending order
    int z=sizeof(a)/sizeof(a[0]); ///size of array
    string s,x;
    transform(s.begin(),s.end(),s.begin(),::tolower);///change of uppercase to lowercase of any string
    int i;
    i=s.compare(x); ///compare two string like strcmp
    int n,m;
    i=log10(n)+1; ///how many digits in integer n
    i=abs(n-m); ///take absolute value
     copy(v.begin(),v.end(),back_inserter(q)); ///copying v vector to q
     s.find("AB"); ///search index Number of AB(substring) in string s
     remove(a,a+n,3); ///delete 3rd element from array
     ceil(2.3) /// Returns the smallest integer that is greater than or equal to x (i.e : rounds up the nearest integer) দশমিক যদি <=.৫ হয় তাহলে একযোগ করে প্রিন্ট করবে
     round(2.3)///return round value...like 2.3=2,,,2.5=3,,2.6=3;

     {
         ///int to string transfer///
         ostringstream temp; ///need a temp;
         int x;
         temp<<x;
         string s;
         s=temp.str(x); ///transfer
     }
     count(s.begin(), s.end(), 'a')///Count the number of occurrences of 'a' in a string s
*/

//
//debug
#ifdef ahasun
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif
//****************Source Code starting From here**************//

int main()
{
	string s,t;
	t="ABC";
	int n,k,ans=0,l=t.length();
	cin>>n>>k>>s;
	if(k==2)
		l--;
	if(k==2)
	{
		string p,q;
		for(int i=0;i<=n/2;i++)
		{
			p+="AB";
			q+="BA";
		}
		int x=0,y=0;
		for(int i=0;i<n;i++)
		{
			if(s[i]!=p[i])
				x++;
			if(s[i]!=q[i])
				y++;
		}
		if(x<y)
		{
			ans=x;
			s=p;
		}
		else
		{
			ans=y;
			s=q;
		}
	}
	if(k!=2){
	for(int i=1;i<n;i++)
	{
		int z=0,x=0;
		if(s[i]==s[i-1])
		{
			z=1;
			char ch;
			//int x=0;
			for(int j=0;j<l;j++)
			{
				if(s[i-1]!=t[j] && s[i+1]!=t[j] && x==0)
				{
					ch=t[j];
					x=1;
				}
			}
			if(x==1)
			{
				s[i]=ch;
				ans++;
			}
		}
		if(z==1 && x==0)
		{
			char ch;
			for(int j=0;j<l;j++)
			{
				if(s[i-1]!=t[j] && s[i-2]!=t[j] && x==0)
				{
					ch=t[j];
					x=1;
				}
			}
			if(x==1)
			{
				s[i-1]=ch;
				ans++;
			}
		}
	}}
	cout<<ans<<endl;
	for(int i=0;i<n;i++)
		cout<<s[i];
	//rt main();
}


//****************************Bismillahir Rahmanir Rahim***************************//

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define rt return

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

/*
bool seive[1010000];
vi prime;

void seiveGen(int limit) {
    limit += 100;
    int sqrtn = sqrt(limit);
    for(int i = 3; i <= sqrtn; i += 2) {
            if(!seive[i>>1]) {
                    for(int j = i * i; j < limit; j += i + i) {
                            seive[j>>1] = 1;
                    }
            }
    }
    prime.PB(2);
    for(int i = 3; i < limit; i += 2) {
            if(!seive[i>>1]) prime.PB(i);
    }
}
*/
/*
*******************************USE of STL***************************
v.erase(unique(v.begin(),v.end()),v.end());
    int a[]={..........};
    sort(a,a+n,greater<int>()); ///sort in descending order
    int z=sizeof(a)/sizeof(a[0]); ///size of array
    string s,x;
    transform(s.begin(),s.end(),s.begin(),::tolower);///change of uppercase to lowercase of any string
    int i;
    i=s.compare(x); ///compare two string like strcmp
    int n,m;
    i=log10(n)+1; ///how many digits in integer n
    i=abs(n-m); ///take absolute value
     copy(v.begin(),v.end(),back_inserter(q)); ///copying v vector to q
     s.find("AB"); ///search index Number of AB(substring) in string s
     remove(a,a+n,3); ///delete 3rd element from array
     ceil(2.3) /// Returns the smallest integer that is greater than or equal to x (i.e : rounds up the nearest integer) দশমিক যদি <=.৫ হয় তাহলে একযোগ করে প্রিন্ট করবে
     round(2.3)///return round value...like 2.3=2,,,2.5=3,,2.6=3;

     {
         ///int to string transfer///
         ostringstream temp; ///need a temp;
         int x;
         temp<<x;
         string s;
         s=temp.str(x); ///transfer
     }
     count(s.begin(), s.end(), 'a')///Count the number of occurrences of 'a' in a string s
*/

//
//debug
#ifdef ahasun
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
#else
#define dbg(args...)
#endif
//****************Source Code starting From here**************//

int main()
{
	string s,t;
	t="ABC";
	int n,k,ans=0,l=t.length();
	cin>>n>>k>>s;
	if(k==2)
		l--;
	for(int i=1;i<n;i++)
	{
		int z=0,x=0;
		if(s[i]==s[i-1])
		{
			z=1;
			char ch;
			//int x=0;
			for(int j=0;j<l;j++)
			{
				if(s[i-1]!=t[j] && s[i+1]!=t[j] && x==0)
				{
					ch=t[j];
					x=1;
				}
			}
			if(x==1)
			{
				s[i]=ch;
				ans++;
			}
		}
		if(z==1 && x==0)
		{
			char ch;
			for(int j=0;j<l;j++)
			{
				if(s[i-1]!=t[j] && s[i-2]!=t[j] && x==0)
				{
					ch=t[j];
					x=1;
				}
			}
			if(x==1)
			{
				s[i-1]=ch;
				ans++;
			}
		}
	}
	cout<<ans<<endl<<s<<endl;;
	//rt main();
}