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.*;
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
            new Solve().solve();
    }
}
class Solve{
    public void solve(){
            FastReader in = new FastReader(System.in);
            FastWriter out = new FastWriter(System.out);
            int n = in.nextInt();
            int k = in.nextInt();
            String s = in.nextString();
            int[][] save = new int[n+5][30];
            StringBuilder sone = new StringBuilder(s);
            StringBuilder stwo = new StringBuilder(s);
            char[] ch=new char[2];
            ch[0]='A'; ch[1]='B';
            for(int i=0;i<n;i++)
                sone.setCharAt(i,ch[i%2]);
            for(int i=1;i<=n;i++)
                stwo.setCharAt(i-1,ch[i%2]);
            if(k==2){
                int one=0,two=0;
                for(int i=0;i<n;i++)
                    if(s.charAt(i) != ch[i%2])
                        one++;
                for(int i=1;i<=n;i++)
                    if(s.charAt(i-1) != ch[i%2])
                        two++;
                if(one<two){
                    out.println(one);
                out.print(sone);
                    return;
                }
                else{
                    out.println(two);
                    out.print(stwo);
                    return;
                }
            }
            StringBuilder str= new StringBuilder(s);
            int[][] dp = new int[n+5][k+5];
            for(int i=0;i<n+5;i++)
                Arrays.fill(dp[i],1000000);
            for(int i=0;i<n;i++){
                if(i==0){
                    for(int j=0;j<k;j++)
                        if(s.charAt(i)-'A' == j){
                            dp[0][j]=0;
                            save[i][j]=1;
                        }
                        else {
                            dp[i][j]=1;
                            save[i][j]=0;
                        }
                    continue;
                }
                int min1=9302494,min2=9039454,ind1=0,ind2=0;
                for(int j=0;j<k;j++){
                    if(j==s.charAt(i)-'A')
                        dp[i][j] = save[i-1][j];
                    else dp[i][j] = save[i-1][j] + 1;
                    if(dp[i][j] < min1) {
                        min2 = min1;
                        min1 = dp[i][j];
                        ind2 = ind1;
                        ind1 = j;
                    }
                    else if(dp[i][j] < min2){
                        min2 = dp[i][j];
                        ind2 = j;
                    }
                }
                for(int j=0;j<k;j++)
                    if(ind1==j)
                        save[i][j]=min2;
                    else save[i][j] = min1;
            }
            int ans = 90358964;
            for(int i=0;i<k;i++)
                ans= Math.min(ans,dp[n-1][i]);
            out.println(ans);
            for(int i=n-1;i>=0;i--){
                if(i==n-1){
                    int j=0;
                    for(j=0;j<k;j++)
                        if(ans==dp[i][j])
                            break;
                    str.setCharAt(i,(char)('A'+j));
                    continue;
                }
                int minval = 90490039,f2=0,ind1=0,f1=0,ind2=0;
                for(int j=0;j<k;j++)
                    if(minval > dp[i][j]){
                        ind1 = j;
                        minval = dp[i][j];
                    }
                for(int j=0;j<k;j++)if(minval == dp[i][j])f1++;
                str.setCharAt(i,(char)('A'+ind1));

                ind2 = str.charAt(i+1)-'A';
                for(int j=0;j<k;j++)
                    if(dp[i+1][ind2] == dp[i+1][j])f2++;

                if(ind1 == str.charAt(i+1)-'A'){
                    if(f1==1){
                        minval= 58095676;
                        for(int j=0;j<k;j++)
                            if(i+2 < n) {
                                if (minval > dp[i + 1][j] && j != ind1 && i + 2 < n && (str.charAt(i + 2) - 'A') != j) {
                                    ind2 = j;
                                    minval = dp[i + 1][j];
                                }
                            }
                        else {
                            if(minval > dp[i + 1][j] && j != ind1){
                                ind2 = j;
                                minval = dp[i + 1][j];
                            }
                        }
                        str.setCharAt(i+1,(char)('A'+ind2));
                    }
                    else if(f2==1){
                        minval= 58095676;
                        for(int j=0;j<k;j++)
                            if(minval > dp[i][j] && j!=ind2){
                                ind1 = j;
                                minval = dp[i][j];
                            }
                        str.setCharAt(i,(char)('A'+ind1));
                    }
                }
            }
            out.print(str);
    }
    private static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E') {
                    return res * Math.pow(10, nextInt());
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E') {
                        return res * Math.pow(10, nextInt());
                    }
                    if (c < '0' || c > '9') {
                        throw new InputMismatchException();
                    }
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return nextString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    private static class FastWriter {
        private final PrintWriter writer;

        public FastWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public FastWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void printt(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
            writer.flush();
        }

        public void println(Object... objects) {
            printt(objects);
            writer.println();
            writer.flush();
        }

        public void print(Object... objects) {
            printt(objects);
            writer.flush();
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }
    }
}