#include <bits/stdc++.h>
using namespace std;
struct cell {
  int i, j;
  int dp_val;
};
int arr[501][501];
int n, m;
int dp[501][26][26];
int flag[501][26][26][2];
int flag_out[501][501];
vector<cell> v;
int get1(int row, int a, int b) {
  int res = 0;
  for (int i = 0; i < m; i++) {
    if (i % 2 == 0) {
      if (arr[row][i] != a) res++;
    } else {
      if (arr[row][i] != b) res++;
    }
  }
  return res;
}
bool compare(cell a, cell b) {
  if (a.dp_val < b.dp_val) return 1;
  if (a.dp_val == b.dp_val)
    if (a.i < b.i) return 1;
  if (a.dp_val == b.dp_val)
    if (a.i == b.i) return (a.j < b.j);
  return 0;
}
int main() {
  scanf("%d %d", &n, &m);
  char c;
  scanf("%c", &c);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (i == n - 1)
        cin >> c;
      else
        scanf("%c", &c);
      arr[i][j] = int(c) - int('a');
    }
    if (i < n - 1) scanf("%c", &c);
  }
  cell ccc;
  int res = 1000000;
  int lasti, lastj;
  for (int i = 0; i < 26; i++)
    for (int j = 0; j < 26; j++) {
      ccc.i = i;
      ccc.j = j;
      if (i == j)
        ccc.dp_val = 1000000;
      else
        ccc.dp_val = dp[0][i][j] = get1(0, i, j);
      v.push_back(ccc);
      if (res > ccc.dp_val) {
        res = ccc.dp_val;
        lasti = i;
        lastj = j;
      }
      res = min(res, ccc.dp_val);
    }
  if (n > 1) res = 1000000;
  for (int r = 1; r < n; r++) {
    sort(v.begin(), v.end(), compare);
    for (int i = 0; i < 26; i++)
      for (int j = 0; j < 26; j++) {
        if (i == j) {
          dp[r][i][j] = 1000000;
          continue;
        }
        int d = get1(r, i, j);
        int minv = 1000000;
        for (int k = 0; k < v.size(); k++)
          if (v[k].i != i && v[k].j != j && v[k].i != v[k].j) {
            minv = v[k].dp_val;
            flag[r][i][j][0] = v[k].i;
            flag[r][i][j][1] = v[k].j;
            break;
          }
        dp[r][i][j] = minv + d;
        if (r == n - 1)
          if (res > minv + d) {
            res = minv + d;
            lasti = i;
            lastj = j;
          }
      }
    if (r < n - 1)
      for (int i = 0; i < 26; i++)
        for (int j = 0; j < 26; j++) {
          v[i * 26 + j].i = i;
          v[i * 26 + j].j = j;
          v[i * 26 + j].dp_val = dp[r][i][j];
        }
  }
  printf("%d\n", res);
  for (int i = 0; i < m; i++) {
    if (i % 2 == 0)
      flag_out[n - 1][i] = lasti;
    else
      flag_out[n - 1][i] = lastj;
  }
  int ii, jj;
  ii = lasti;
  jj = lastj;
  for (int i = n - 1; i > 0; i--) {
    for (int j = 0; j < m; j++) {
      if (j % 2 == 0)
        flag_out[i - 1][j] = flag[i][ii][jj][0];
      else
        flag_out[i - 1][j] = flag[i][ii][jj][1];
    }
    lasti = ii;
    lastj = jj;
    ii = flag[i][lasti][lastj][0];
    jj = flag[i][lasti][lastj][1];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) printf("%c", char(flag_out[i][j] + int('a')));
    printf("\n");
  }
  return 0;
}
