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

Difficulty: MEDIUM_HARD

Solutions:
(n, k) = map(int, input().split())
s = input()
if k == 2:
	x = 'A'
	y = 'B'
	for i in range(1, n):
		if x[-1] == 'A':
			x += 'B'
		else:
			x += 'A'
		if y[-1] == 'A':
			y += 'B'
		else:
			y += 'A'
	p1 = 0
	p2 = 0
	for i in range(n):
		if x[i] != s[i]:
			p1 += 1
		if y[i] != s[i]:
			p2 += 1
	if p1 >= p2:
		print(p2)
		print(y)
	else:
		print(p1)
		print(x)
	exit()
ans = s[0]
colors = []
pts = 0
for i in range(k):
	colors.append(chr(i + 65))
for i in range(1, n):
	x = s[i]
	if x != ans[-1]:
		ans += x
	elif k == 2 or i == n - 1:
		for y in colors:
			if y != x:
				ans += y
				pts += 1
				break
	else:
		z = s[i + 1]
		for y in colors:
			if y != x and y != z:
				ans += y
				pts += 1
				break
print(pts)
print(ans)


(n, k) = map(int, input().strip().split())
s = list(input())
options = [chr(ord('A') + i) for i in range(k)]
ans = 0
if k == 2:
	ans1 = ['A' if i % 2 == 0 else 'B' for i in range(n)]
	diff1 = 0
	for i in range(n):
		if s[i] != ans1[i]:
			diff1 += 1
	if diff1 < n - diff1:
		print(diff1)
		print(''.join(ans1))
	else:
		print(n - diff1)
		print('B' + ''.join(ans1[:-1]))
else:
	for i in range(1, n - 1):
		if s[i] == s[i - 1]:
			ans += 1
			for j in options:
				if j != s[i - 1] and j != s[i + 1]:
					s[i] = j
					break
	if n > 1 and s[-2] == s[-1]:
		ans += 1
		s[-1] = options[0] if options[0] != s[-2] else options[1]
	print(ans)
	print(''.join(s))


(n, k) = list(map(int, input().split()))
a = [i for i in input()]
b = 0
if k == 2:
	for i in range(n):
		if a[i] != 'AB'[i % 2]:
			b += 1
	if b < n - b:
		print(b)
		print('AB' * (n // 2) + 'A' * (n % 2))
	else:
		print(n - b)
		print('BA' * (n // 2) + 'B' * (n % 2))
else:
	for i in range(1, n):
		if a[i] == a[i - 1]:
			for j in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[:k]:
				if j != a[i - 1] and (i == n - 1 or j != a[i + 1]):
					a[i] = j
					b += 1
					break
	print(b)
	print(''.join(a))


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
a = 'abcdefghijklmnopqrstuvwxyz'
a = a.upper()
(n, k) = I()
s = list(input() + 'aaa')
ans = 0
if k > 2:
	for i in range(1, n):
		if s[i] == s[i - 1]:
			for j in range(k):
				if a[j] != s[i - 1] and a[j] != s[i + 1]:
					ans += 1
					s[i] = a[j]
					break
			else:
				for j in range(k):
					if a[j] != s[i - 1]:
						ans += 1
						s[i] = a[j]
						break
else:
	x = 'AB' * (n // 2) + 'A' * (n % 2)
	y = 'BA' * (n // 2) + 'B' * (n % 2)
	a1 = 0
	a2 = 0
	for i in range(n):
		if s[i] != x[i]:
			a1 += 1
		if s[i] != y[i]:
			a2 += 1
	ans = min(a1, a2)
	s = [y, x][a1 < a2]
print(ans)
print(''.join(s[:n]))


from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)
import sys

def I():
	return int(stdin.readline())

def lint():
	return [int(x) for x in stdin.readline().split()]

def S():
	return input().strip()

def grid(r, c):
	return [lint() for i in range(r)]
from collections import defaultdict, Counter, deque
import math
import heapq
from heapq import heappop, heappush
import bisect
from itertools import groupby

def gcd(a, b):
	while b:
		a %= b
		tmp = a
		a = b
		b = tmp
	return a

def lcm(a, b):
	return a // gcd(a, b) * b

def check_prime(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def Bs(a, x):
	i = 0
	j = 0
	left = 1
	right = x
	flag = False
	while left < right:
		mi = (left + right) // 2
		if a[mi] <= x:
			left = mi + 1
			i += 1
		else:
			right = mi
			j += 1
	if left > 0 and a[left - 1] == x:
		return (i - 1, j)
	else:
		return (-1, -1)

def nCr(n, r):
	return fact(n) // (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res

def primefactors(n):
	num = 0
	while n % 2 == 0:
		num += 1
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			num += 1
			n = n // i
	if n > 2:
		num += 1
	return num

def ask(a):
	print('? {}'.format(a), flush=True)
	n = I()
	return n

def dfs(i, p):
	(a, tmp) = (0, 0)
	for j in d[i]:
		if j != p:
			a += 1
			tmp += dfs(j, i)
	if a == 0:
		return 0
	return tmp / a + 1

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n // 2
	if n > 2:
		l.append(n)
	return l
(n, k) = lint()
p = list(map(str, input().strip()))
s = p.copy()
ans = 0
if k == 2:
	tmp = ['A', 'B']
	cnt = 0
	for i in range(n):
		if s[i] != tmp[i % 2]:
			cnt += 1
	if cnt < n - cnt:
		c = (['A', 'B'] * (n // 2 + 1))[:n]
		print(cnt)
		print(''.join(c))
	else:
		c = (['A', 'B'] * (n // 2 + 1))[1:n + 1]
		print(n - cnt)
		print(''.join(c))
else:
	tmp = s[0]
	for i in range(1, n):
		if s[i] == tmp:
			for j in range(26):
				r = chr(65 + j)
				if r not in [s[i - 1], s[min(i + 1, n - 1)]]:
					s[i] = r
					tmp = r
					break
		else:
			tmp = s[i]
	for i in range(n):
		if s[i] != p[i]:
			ans += 1
	print(ans)
	print(''.join(s))


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
decimal.getcontext().prec = 46

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def new_chr(a, b, alpha, k):
	for i in range(k):
		if alpha[i] != a and alpha[i] != b:
			return alpha[i]

def solve():
	(n, k) = num_input()
	s = input()
	if n == 1:
		print(0)
		print(s)
		return
	s = list(s)
	if k == 2:
		s1 = 'AB' * (n // 2)
		s2 = 'BA' * (n // 2)
		if n % 2 != 0:
			s1 += 'A'
			s2 += 'B'
		c1 = c2 = 0
		for i in range(n):
			if s[i] != s1[i]:
				c1 += 1
			if s[i] != s2[i]:
				c2 += 1
		if c1 < c2:
			print(c1)
			print(s1)
		else:
			print(c2)
			print(s2)
	else:
		alpha = ['A']
		for i in range(1, 26):
			alpha.append(chr(ord('A') + i))
		i = 0
		ans = 0
		while i < n - 1:
			if s[i] == s[i + 1]:
				count = 1
				j = i + 1
				while j < n and s[i] == s[j]:
					count += 1
					if count % 2 == 0:
						if j + 1 < n:
							s[j] = new_chr(s[j], s[j + 1], alpha, k)
						else:
							s[j] = new_chr(s[j], s[j], alpha, k)
					j += 1
				ans += count // 2
			else:
				i += 1
		print(ans)
		print(''.join(s))
t = 1
for _ in range(t):
	solve()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
s = input()
if k == 2:
	s1 = 'AB' * (len(s) // 2)
	if len(s) % 2:
		s1 += 'A'
	s2 = 'BA' * (len(s) // 2)
	if len(s) % 2:
		s2 += 'B'
	ans1 = 0
	ans2 = 0
	for i in range(len(s)):
		if s1[i] != s[i]:
			ans1 += 1
		if s2[i] != s[i]:
			ans2 += 1
	if ans1 < ans2:
		print(ans1)
		print(s1)
	else:
		print(ans2)
		print(s2)
else:
	s1 = []
	ans = 0
	l = []
	i = 0
	while i < len(s):
		if i == len(s) - 1:
			l.append([1, len(s) - 1, len(s) - 1])
			break
		if s[i] == s[i + 1]:
			c = 1
			j = i
			while s[i] == s[i + 1]:
				c += 1
				i += 1
				if i == len(s) - 1:
					break
			l.append([c, j, i])
			i += 1
		else:
			l.append([1, i, i])
			i += 1
	for j in l:
		if j[0] == 1:
			s1.append(s[j[1]])
		else:
			a = 0
			for p in range(j[1], j[2] + 1):
				if a == 0:
					s1.append(s[p])
					a ^= 1
				else:
					for q in range(k):
						if chr(65 + q) != s[p]:
							s1.append(chr(65 + q))
							break
					ans += 1
					a ^= 1
			if j[0] % 2 == 0:
				if j[2] != len(s) - 1:
					if s1[j[2]] == s[j[2] + 1]:
						for p in range(k):
							if chr(65 + p) != s[j[2] + 1] and chr(65 + p) != s[j[2]]:
								s1[j[2]] = chr(65 + p)
								break
	print(ans)
	print(''.join(s1))


import math
(n, k) = map(int, input().split())
s = list(input())
alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
ltrs = alphabet[:k]
if k == 2:
	s1 = ('AB' * math.ceil(n / 2))[:n]
	s2 = ('BA' * math.ceil(n / 2))[:n]
	(diff1, diff2) = (0, 0)
	for i in range(n):
		if s1[i] != s[i]:
			diff1 += 1
		if s2[i] != s[i]:
			diff2 += 1
	if diff1 < diff2:
		print(diff1)
		print(s1)
	else:
		print(diff2)
		print(s2)
	exit()
c = 0
for i in range(1, n - 1):
	if s[i] == s[i - 1]:
		oneneed = 0
		c += 1
		for l in ltrs:
			if l != s[i - 1] and l != s[i + 1]:
				s[i] = l
				oneneed = 1
				break
		if oneneed == 0:
			for l in ltrs:
				if l != s[i - 1]:
					s[i] = l
					break
if n > 1:
	if s[-1] == s[-2]:
		for l in ltrs:
			if l != s[-2]:
				s[-1] = l
				c += 1
				break
print(c)
print(''.join(s))


(n, k) = [int(x) for x in input().split()]
s = input()
if k == 2:
	str1 = 'AB' * n
	str2 = 'BA' * n
	diff1 = 0
	diff2 = 0
	for i in range(n):
		if s[i] != str1[i]:
			diff1 += 1
		else:
			diff2 += 1
	if diff1 < diff2:
		print(diff1)
		print(str1[:n])
	else:
		print(diff2)
		print(str2[:n])
else:
	l = [chr(i + ord('A')) for i in range(k)]
	s += '_'
	s = '_' + s
	s = list(s)
	resVal = 0
	for i in range(1, n + 1):
		if s[i] != s[i - 1]:
			continue
		resVal += 1
		possible_changes = [x for x in l if x != s[i - 1] and x != s[i + 1]]
		s[i] = possible_changes[0]
	del s[0]
	del s[-1]
	s = ''.join(s)
	print(resVal)
	print(s)


(n, k) = map(int, input().split())
s = input()
temp = []
for i in range(len(s)):
	temp.append(s[i])
ans = []
tans = []
for i in range(len(s)):
	ans.append(s[i])
	tans.append(s[i])
if k == 2:
	c1 = 0
	count = 0
	for i in range(len(ans)):
		if i % 2 == 0:
			if ans[i] == 'B':
				ans[i] = 'A'
				c1 += 1
		elif ans[i] == 'A':
			ans[i] = 'B'
			c1 += 1
	for i in range(len(tans)):
		if i % 2 == 0:
			if tans[i] == 'A':
				tans[i] = 'B'
				count += 1
		elif tans[i] == 'B':
			tans[i] = 'A'
			count += 1
	if count > c1:
		print(c1)
		print(''.join(map(str, ans)))
	else:
		print(count)
		print(''.join(map(str, tans)))
else:
	for i in range(1, len(ans)):
		if ans[i - 1] == ans[i]:
			if ans[i] == 'A':
				if i + 1 < len(ans):
					if ans[i + 1] == 'B':
						ans[i] = 'C'
					else:
						ans[i] = 'B'
				else:
					ans[i] = 'B'
			elif i + 1 < len(ans):
				if ans[i + 1] == 'A':
					if ans[i] == 'B':
						ans[i] = 'C'
					else:
						ans[i] = 'B'
				else:
					ans[i] = 'A'
			else:
				ans[i] = 'A'
	count = 0
	for i in range(len(temp)):
		if temp[i] != ans[i]:
			count += 1
	print(count)
	print(''.join(map(str, ans)))


(n, k) = map(int, input().split())
s = input()
l = []
ans = 0
if k == 2:
	s1 = []
	s2 = []
	for i in range(n):
		if i & 1:
			s1.append('A')
			s2.append('B')
		else:
			s2.append('A')
			s1.append('B')
	a1 = 0
	a2 = 0
	for i in range(n):
		if s[i] != s1[i]:
			a1 += 1
		if s[i] != s2[i]:
			a2 += 1
	if a1 > a2:
		print(a2)
		print(''.join(s2))
	else:
		print(a1)
		print(''.join(s1))
else:
	for i in range(n):
		if len(l) == 0:
			l.append(s[i])
		elif l[-1] == s[i]:
			if i != n - 1:
				a = l[-1]
				b = s[i + 1]
				if a == b:
					if a == 'A':
						l.append('B')
					else:
						l.append('A')
				elif a == 'A' and b != 'B':
					l.append('B')
				elif a == 'A' and b == 'B':
					l.append('C')
				elif a != 'B' and b == 'A':
					l.append('B')
				elif a == 'B' and b == 'A':
					l.append('C')
				else:
					l.append('A')
			elif l[-1] == 'A':
				l.append('B')
			else:
				l.append('A')
			ans += 1
		else:
			l.append(s[i])
	print(ans)
	print(''.join(l))