18_E. Flag 2
According to a new ISO standard, a flag of every country should have, strangely enough, a chequered field n × m, each square should be wholly painted one of 26 colours. The following restrictions are set: 

  * In each row at most two different colours can be used. 
  * No two adjacent squares can be painted the same colour. 



Pay attention, please, that in one column more than two different colours can be used.

Berland's government took a decision to introduce changes into their country's flag in accordance with the new standard, at the same time they want these changes to be minimal. By the given description of Berland's flag you should find out the minimum amount of squares that need to be painted different colour to make the flag meet the new ISO standard. You are as well to build one of the possible variants of the new Berland's flag.

Input

The first input line contains 2 integers n and m (1 ≤ n, m ≤ 500) — amount of rows and columns in Berland's flag respectively. Then there follows the flag's description: each of the following n lines contains m characters. Each character is a letter from a to z, and it stands for the colour of the corresponding square.

Output

In the first line output the minimum amount of squares that need to be repainted to make the flag meet the new ISO standard. The following n lines should contain one of the possible variants of the new flag. Don't forget that the variant of the flag, proposed by you, should be derived from the old flag with the minimum amount of repainted squares. If the answer isn't unique, output any.

Examples

Input

3 4
aaaa
bbbb
cccc


Output

6
abab
baba
acac


Input

3 3
aba
aba
zzz


Output

4
aba
bab
zbz
```python
import sys
from array import array  # noqa: F401


def input():
    return sys.stdin.buffer.readline().decode('utf-8')


n, m = map(int, input().split())
flag = [tuple(map(lambda c: ord(c) - 97, input().rstrip())) for _ in range(n)]
dp = [[[m] * 26 for _ in range(26)] for _ in range(n)]

for i in range(n):
    for j in range(m):
        if (j & 1) == 0:
            for k in range(26):
                dp[i][flag[i][j]][k] -= 1
        else:
            for k in range(26):
                dp[i][k][flag[i][j]] -= 1

    if i > 0:
        for j in range(26):
            left = [10**5 * 3] * 26
            right = [10**5 * 3] * 27

            for x in range(26):
                if j == x:
                    continue
                for y in range(26):
                    if x == y:
                        continue
                    if y > 0 and left[y - 1] > dp[i - 1][x][y]:
                        left[y - 1] = dp[i - 1][x][y]
                    if right[y + 1] > dp[i - 1][x][y]:
                        right[y + 1] = dp[i - 1][x][y]

            for k in range(24, -1, -1):
                if left[k] > left[k + 1]:
                    left[k] = left[k + 1]
            for k in range(26):
                dp[i][j][k] += left[k] if left[k] < right[k] else right[k]
                if right[k] < right[k + 1]:
                    right[k + 1] = right[k]


ans = 10**9
p_i, p_j = -1, -1
for i in range(26):
    for j in range(26):
        if i == j:
            continue
        if ans > dp[-1][i][j]:
            ans = dp[-1][i][j]
            p_i, p_j = i, j

new_flag = []
for i in range(n - 1, -1, -1):
    row = (chr(97 + p_i) + chr(97 + p_j)) * (m >> 1) + (chr(97 + p_i) if m & 1 else '')
    new_flag.append(row)
    if i:
        min_v = 10**9
        n_i, n_j = -1, -1
        for j in range(26):
            if p_i == j:
                continue
            for k in range(26):
                if p_j != k and j != k and min_v > dp[i - 1][j][k]:
                    min_v = dp[i - 1][j][k]
                    n_i, n_j = j, k
        p_i, p_j = n_i, n_j

print(ans)
for row in reversed(new_flag):
    print(row)

```