#include <bits/stdc++.h>
static const int N = 501;
static const int M = 26;
static const int INF = 1e6;
int n, m;
char a[N][N];
int d[N][M * M];
int f[N][M * M];
int p[N][M * M];
int main() {
  scanf("%d%d%*c", &n, &m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) scanf("%c", &a[i][j]);
    getchar();
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < M; j++) {
      for (int k = 0; k < M; k++) {
        for (int l = 0; l < m; l += 2) d[i][j + M * k] += (a[i][l] != 'a' + j);
        for (int l = 1; l < m; l += 2) d[i][j + M * k] += (a[i][l] != 'a' + k);
      }
    }
  }
  for (int i = 0; i < M * M; i++) {
    for (int j = 0; j < n; j++) f[j][i] = INF;
    f[0][i] = d[0][i];
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < M * M; j++) {
      int ay = j / M, ax = j - ay * M;
      if (ax == ay) continue;
      for (int k = 0; k < M * M; k++) {
        int by = k / M, bx = k - by * M;
        if (bx == by || bx == ax || by == ay) continue;
        if (f[i][j] > f[i - 1][k] + d[i][j]) {
          f[i][j] = f[i - 1][k] + d[i][j];
          p[i][j] = k;
        }
      }
    }
  }
  int ans = INF, cur = 0;
  for (int i = 0; i < M * M; i++) {
    int y = i / M, x = i - y * M;
    if (x == y) continue;
    if (f[n - 1][i] < ans) ans = f[n - 1][i], cur = i;
  }
  for (int i = n - 1; i >= 0; i--) {
    int y = cur / M, x = cur - y * M;
    for (int j = 0; j < m; j += 2) a[i][j] = 'a' + x;
    for (int j = 1; j < m; j += 2) a[i][j] = 'a' + y;
    cur = p[i][cur];
  }
  printf("%d\n", ans);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) putchar(a[i][j]);
    putchar('\n');
  }
  return 0;
}
