#include <bits/stdc++.h>
using namespace std;
int n, m, f[550][26][26], fx[550][26][26], fy[550][26][26];
char a[550][550];
int calc(int n, int x, int y) {
  int s = 0;
  for (int i = 0; i < m; i++) {
    int v = int(a[n][i]) - int('a');
    s += int((i % 2 == 0 ? x : y) != v);
  }
  return s;
}
int main() {
  scanf("%d%d\n", &n, &m);
  for (int i = 0; i < n; i++) gets(a[i]);
  for (int r = 0; r < n; r++)
    for (int i = 0; i < 26; i++)
      for (int j = 0; j < 26; j++) {
        int v = calc(r, i, j);
        if (r == 0)
          f[r][i][j] = v;
        else {
          int now = n * m;
          for (int x = 0; x < 26; x++)
            if (x != i)
              for (int y = 0; y < 26; y++)
                if (y != x && y != j && now > f[r - 1][x][y] + v) {
                  now = f[r - 1][x][y] + v;
                  fx[r][i][j] = x;
                  fy[r][i][j] = y;
                }
          f[r][i][j] = now;
        }
      }
  int res = n * m, x, y;
  for (int i = 0; i < 26; i++)
    for (int j = 0; j < 26; j++)
      if (i != j && res > f[n - 1][i][j]) {
        res = f[n - 1][i][j];
        x = i;
        y = j;
      }
  printf("%d\n", res);
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < m; j++)
      a[i][j] = (j % 2 == 0 ? char(x + 97) : char(y + 97));
    int xx = fx[i][x][y];
    int yy = fy[i][x][y];
    x = xx;
    y = yy;
  }
  for (int i = 0; i < n; i++) puts(a[i]);
  return 0;
}
