#include <bits/stdc++.h>
using namespace std;
const double pi = 3.1415926535;
const double eps = 1e-6;
int n, m, ma[510][510], f[510][26][26], g[510][26][26], px[510][26][26],
    py[510][26][26];
char ch;
bool update(int &a, int b) {
  if (b == -1) return 0;
  if (a == -1 || a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      scanf(" %c", &ch);
      ma[i][j] = ch - 'a';
    }
  for (int i = 1; i <= n; i++) {
    for (int x = 0; x < 26; x++)
      for (int y = 0; y < 26; y++) {
        g[i][x][y] = 0;
        for (int j = 1; j <= m; j++)
          if (j & 1)
            g[i][x][y] += (ma[i][j] - x != 0);
          else
            g[i][x][y] += (ma[i][j] - y != 0);
      }
  }
  memset(f, -1, sizeof(f));
  memset(f[0], 0, sizeof(f[0]));
  for (int i = 1; i <= n; i++)
    for (int x1 = 0; x1 < 26; x1++)
      for (int y1 = 0; y1 < 26; y1++)
        if (f[i - 1][x1][y1] != -1)
          for (int x2 = 0; x2 < 26; x2++)
            if (x2 != x1)
              for (int y2 = 0; y2 < 26; y2++)
                if (y2 != y1 && x2 != y2)
                  if (update(f[i][x2][y2], f[i - 1][x1][y1] + g[i][x2][y2])) {
                    px[i][x2][y2] = x1;
                    py[i][x2][y2] = y1;
                  }
  int best = -1, rx, ry;
  for (int x1 = 0; x1 < 26; x1++)
    for (int y1 = 0; y1 < 26; y1++)
      if (x1 != y1)
        if (update(best, f[n][x1][y1])) rx = x1, ry = y1;
  printf("%d\n", best);
  for (int i = n; i >= 1; i--) {
    for (int j = 1; j <= m; j++)
      if (j & 1)
        ma[i][j] = rx;
      else
        ma[i][j] = ry;
    int tx = px[i][rx][ry];
    int ty = py[i][rx][ry];
    rx = tx, ry = ty;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) putchar(ma[i][j] + 'a');
    puts("");
  }
}
