Problem: A colored stripe is represented by a horizontal row of n square cells, each cell is pained one of k colors. Your task is to repaint the minimum number of cells so that no two neighbouring cells are of the same color. You can use any color from 1 to k to repaint the cells.

Input

The first input line contains two integers n and k (1 ≤ n ≤ 5·105; 2 ≤ k ≤ 26). The second line contains n uppercase English letters. Letter "A" stands for the first color, letter "B" stands for the second color and so on. The first k English letters may be used. Each letter represents the color of the corresponding cell of the stripe.

Output

Print a single integer — the required minimum number of repaintings. In the second line print any possible variant of the repainted stripe.

Examples

Input

6 3
ABBACC


Output

2
ABCACA


Input

3 2
BBB


Output

1
BAB

Solution (in JAVA):

Solution:
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
import java.util.*;
import java.io.*;
public class codeforces 
{ 
   static class Student{
       int x,y;
        Student(int x,int y){
            this.x=x;
            this.y=y;
            //this.z=z;
        }
    }
    static int prime[];
    static void sieveOfEratosthenes(int n) 
    { 
        // Create a boolean array "prime[0..n]" and initialize 
        // all entries it as true. A value in prime[i] will 
        // finally be false if i is Not a prime, else true. 
        int pos=0;
        prime= new int[n+1]; 
        for(int p = 2; p*p <=n; p++) 
        { 
            // If prime[p] is not changed, then it is a prime 
            if(prime[p] == 0)
            { 
                // Update all multiples of p
                prime[p]=p;
                for(int i = p*p; i <= n; i += p) 
                    prime[i] = p; 
            } 
        } 
    }
static    class Sortbyroll implements Comparator<Student> 
{ 
    // Used for sorting in ascending order of 
    // roll number 
    public int compare(Student c, Student b) 
    { 
        return c.x-b.x;
    } 
} 
static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
 
    static class Edge{
        int a,b;
        Edge(int a,int b){
            this.a=a;
            this.b=b;
        }
    }
    static class Trie{
        HashMap<Character,Trie>map;
         int c;
        Trie(){
            map=new HashMap<>();
            //z=null;
            //o=null;
            c=0;
        }
    }
    //static long ans;
    static int parent[];
    static int rank[];
    static int b[][];
    static int bo[];
    static int ho[];
    static int seg[];
    //static int pos;
   // static long mod=1000000007;
    //static int dp[][];
    static HashMap<Integer,Integer>map;
    static PriorityQueue<Student>q=new PriorityQueue<>();
    //static Stack<Integer>st;
   // static ArrayList<Character>ans;
    static ArrayList<ArrayList<Integer>>adj;
    static long ans;
    static Trie root;
    static long fac[];
    static long mod=(long)(1000000007);
    //static int ans;
    static void solve()throws IOException{
        FastReader sc=new FastReader();
        int n,k,ans=0,min,p,i,j,x,t,a,b;
        n=sc.nextInt();
        k=sc.nextInt();
        String s=sc.nextLine();
        char ch[]=s.toCharArray();
        int dp[][]=new int[n][k];
        for(i=0;i<k;i++)
        {
            if(i==(int)s.charAt(0)-65)
                continue;
            dp[0][i]=1;
        }
        for(i=1;i<n;i++){
            a=0;
            for(j=0;j<k;j++){
                if(dp[i-1][j]<dp[i-1][a])
                    a=j;
            }
            b=-1;
            for(j=0;j<k;j++){
                if(j==a)
                    continue;
                if(b==-1||dp[i-1][b]>dp[i-1][j])
                    b=j;
            }
            for(j=0;j<k;j++){
                if(s.charAt(i)-65==j)
                    t=0;
                else
                    t=1;
                if(j==a)
                    dp[i][j]=t+dp[i-1][b];
                else
                    dp[i][j]=t+dp[i-1][a];
            }
        }
        StringBuilder sb=new StringBuilder();
        min=0;
        for(i=0;i<k;i++){
            if(dp[n-1][i]<dp[n-1][min]){
                min=i;
            }
        }
        ans=dp[n-1][min];
        p=min;
        //sb.append((char)(65+min));
        ch[n-1]=(char)(65+min);
        for(i=n-2;i>=0;i--){
            min=-1;
            for(j=0;j<k;j++){
                if(j==p)
                    continue;
                if(min==-1||(dp[i][j]<dp[i][min])){
                    min=j;
                }
            }
            //sb.append((char)(min+65));
            ch[i]=(char)(min+65);
            p=min;
        }
        System.out.println(ans);
        System.out.println(new String(ch));
    }
    static void build(StringBuilder sb,int n,char a){
        if(n==0)
        {
            sb.append(a);
            return;
        }
        int x=(int)Math.sqrt(2*n);
        if(x*(x+1)>2*n)
            x-=1;
        for(int i=0;i<=x;i++)
            sb.append(a);
        n-=(x*(x+1))/2;
        build(sb,n,(char)((int)a+1));
    }
    static void dfs(Trie root,int k){
        if(root==null)
            return;
        for(char i='A';i<='Z';i++){
            if(root.map.containsKey(i)){
                ans+=root.map.get(i).c/k;
                dfs(root.map.get(i),k);
            }
        }
    }
    static long nCr(long n, long r, 
                                    long p) 
    { 
        return (fac[(int)n]* modInverse(fac[(int)r], p) 
                % p * modInverse(fac[(int)(n-r)], p) 
                                    % p) % p; 
    } 
    //static int prime[];
    //static int dp[];
    public static void main(String[] args){
        //long sum=0;
        try {
                codeforces.solve();
                } catch (Exception e) {
                    e.printStackTrace();
                }
    }
       static long modInverse(long n, long p) 
    { 
        return power(n, p-(long)2,p); 
    } 
 static long power(long x, long y, long p) 
{ 
    long res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or  
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y %(long)2!=0) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p;   
    } 
    return res%p;
 }
    /*public static long power(long x,long a) {
		if(a==0) return 1;
		if(a%2==1)return (x*1L*power(x,a-1))%mod;
		return (power((int)((x*1L*x)%mod),a/2))%mod;
	}*/
   static int find(int x) 
    { 
        // Finds the representative of the set 
        // that x is an element of 
        while(parent[x]!=x) 
        { 
            // if x is not the parent of itself 
            // Then x is not the representative of 
            // his set,
            x=parent[x];
  
            // so we recursively call Find on its parent 
            // and move i's node directly under the 
            // representative of this set 
        } 
  
        return x; 
    }
    static void union(int x, int y) 
    { 
        // Find representatives of two sets 
        int xRoot = find(x), yRoot = find(y); 
  
        // Elements are in the same set, no need 
        // to unite anything. 
        if (xRoot == yRoot) 
            return; 
  
         // If x's rank is less than y's rank 
        if (rank[xRoot] < rank[yRoot]) 
  
            // Then move x under y  so that depth 
            // of tree remains less 
            parent[xRoot] = yRoot; 
  
        // Else if y's rank is less than x's rank 
        else if (rank[yRoot] < rank[xRoot]) 
  
            // Then move y under x so that depth of 
            // tree remains less 
            parent[yRoot] = xRoot; 
  
        else // if ranks are the same 
        { 
            // Then move y under x (doesn't matter 
            // which one goes where) 
            parent[yRoot] = xRoot; 
  
            // And increment the the result tree's 
            // rank by 1 
            rank[xRoot] = rank[xRoot] + 1; 
        } 
    } 
    static long gcd(long a, long b) 
    { 
        if (a == 0){ 
             //ans+=b;
            return b;
        }
        return gcd(b % a, a); 
    }
}