#include <bits/stdc++.h>
using namespace std;
const int N = 502;
int i, j, n, m, k, x, y, flag, ans, tot, v[N], INF;
int a[N][N], f[N][27][27], c[N][27][27], b[N][N];
int d[N][4][27][27];
pair<int, int> wh[N][4][27][27], pre[N][27][27], p;
char s[N];
void Test() {
  int A[] = {0, 13, 2, 21, 17, 2, 13, 18, 17, 18, 2};
  int B[] = {0, 2, 22, 17, 18, 13, 2, 13, 2, 17, 18}, i, j = 0;
  for (i = 1; i <= n; i++) {
    tot += c[i][A[i]][B[i]];
    printf("%d %d\n", f[i][A[i]][B[i]], tot);
  }
}
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> s;
    for (j = 0; j < m; j++) a[i][j + 1] = s[j] - 'a' + 1;
  }
  for (i = 1; i <= n; i++)
    for (x = 1; x <= 26; x++)
      for (y = 1; y <= 26; y++)
        for (j = 1; j <= m; j++)
          if (j % 2)
            c[i][x][y] += (a[i][j] != x);
          else
            c[i][x][y] += (a[i][j] != y);
  memset(d, 63, sizeof(d));
  INF = d[0][0][0][0];
  memset(d[0], 0, sizeof(d[0]));
  for (i = 1; i <= n; i++) {
    for (x = 1; x <= 26; x++)
      for (y = 1; y <= 26; y++) {
        if (x != y) {
          f[i][x][y] = d[i - 1][0][x - 1][y - 1];
          pre[i][x][y] = wh[i - 1][0][x - 1][y - 1];
          if (f[i][x][y] > d[i - 1][1][x - 1][y + 1])
            f[i][x][y] = d[i - 1][1][x - 1][y + 1],
            pre[i][x][y] = wh[i - 1][1][x - 1][y + 1];
          if (f[i][x][y] > d[i - 1][2][x + 1][y - 1])
            f[i][x][y] = d[i - 1][2][x + 1][y - 1],
            pre[i][x][y] = wh[i - 1][2][x + 1][y - 1];
          if (f[i][x][y] > d[i - 1][3][x + 1][y + 1])
            f[i][x][y] = d[i - 1][3][x + 1][y + 1],
            pre[i][x][y] = wh[i - 1][3][x + 1][y + 1];
          f[i][x][y] += c[i][x][y];
        } else
          f[i][x][y] = INF;
        d[i][0][x][y] = f[i][x][y];
        wh[i][0][x][y] = make_pair(x, y);
        if (d[i][0][x][y] > d[i][0][x - 1][y])
          d[i][0][x][y] = d[i][0][x - 1][y],
          wh[i][0][x][y] = wh[i][0][x - 1][y];
        if (d[i][0][x][y] > d[i][0][x][y - 1])
          d[i][0][x][y] = d[i][0][x][y - 1],
          wh[i][0][x][y] = wh[i][0][x][y - 1];
      }
    for (x = 1; x <= 26; x++)
      for (y = 26; y >= 1; y--) {
        d[i][1][x][y] = f[i][x][y];
        wh[i][1][x][y] = make_pair(x, y);
        if (d[i][1][x][y] > d[i][1][x - 1][y])
          d[i][1][x][y] = d[i][1][x - 1][y],
          wh[i][1][x][y] = wh[i][1][x - 1][y];
        if (d[i][1][x][y] > d[i][1][x][y + 1])
          d[i][1][x][y] = d[i][1][x][y + 1],
          wh[i][1][x][y] = wh[i][1][x][y + 1];
      }
    for (x = 26; x >= 1; x--)
      for (y = 26; y >= 1; y--) {
        d[i][3][x][y] = f[i][x][y];
        wh[i][3][x][y] = make_pair(x, y);
        if (d[i][3][x][y] > d[i][3][x + 1][y])
          d[i][3][x][y] = d[i][3][x + 1][y],
          wh[i][3][x][y] = wh[i][3][x + 1][y];
        if (d[i][3][x][y] > d[i][3][x][y + 1])
          d[i][3][x][y] = d[i][3][x][y + 1],
          wh[i][3][x][y] = wh[i][3][x][y + 1];
      }
    for (x = 26; x >= 1; x--)
      for (y = 1; y <= 26; y++) {
        d[i][2][x][y] = f[i][x][y];
        wh[i][2][x][y] = make_pair(x, y);
        if (d[i][2][x][y] > d[i][2][x + 1][y])
          d[i][2][x][y] = d[i][2][x + 1][y],
          wh[i][2][x][y] = wh[i][2][x + 1][y];
        if (d[i][2][x][y] > d[i][2][x][y - 1])
          d[i][2][x][y] = d[i][2][x][y - 1],
          wh[i][2][x][y] = wh[i][2][x][y - 1];
      }
  }
  cout << d[n][0][26][26] << endl;
  p = wh[n][0][26][26];
  for (i = n; i >= 1; i--) {
    for (j = 1; j <= m; j++)
      if (j % 2)
        b[i][j] = p.first;
      else
        b[i][j] = p.second;
    p = pre[i][p.first][p.second];
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) printf("%c", 'a' + b[i][j] - 1);
    cout << endl;
  }
}
