#include <bits/stdc++.h>
typedef const int& CI;
int cnt[26][2];
int best[2][26 << 1], id[501][26 << 1];
int path[501][26 << 1], re[501];
char ch[26];
void Update(int v, int lx, CI i, CI j, CI k, CI i1) {
  int j0 = j << 1, j1 = j0 | 1;
  if (v < best[i1][j0]) {
    if (k != id[i][j0]) {
      best[i1][j1] = best[i1][j0];
      id[i][j1] = id[i][j0];
      path[i][j1] = path[i][j0];
    }
    best[i1][j0] = v;
    id[i][j0] = k, path[i][j0] = lx;
  } else if (v < best[i1][j1] && k != id[i][j0]) {
    best[i1][j1] = v;
    id[i][j1] = k, path[i][j1] = lx;
  }
}
int main() {
  for (int i = 0; i < 26; ++i) ch[i] = 'a' + i;
  int n, m, s, l0, i1 = 0, i2 = 1;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i, i1 ^= 1, i2 ^= 1) {
    getchar();
    memset(best[i1], 0x7f, sizeof(best[i1]));
    memset(cnt, 0, sizeof(cnt));
    for (int j = 0; j < m; ++j) {
      ++cnt[getchar() - 'a'][j & 1];
    }
    for (int j = 0; j < 26; ++j)
      for (int k = 0; k < 26; ++k) {
        if (k == j) continue;
        s = m - cnt[j][0] - cnt[k][1];
        for (int l = 0; l < 26; ++l) {
          if (l == j) continue;
          l0 = l << 1;
          if (id[i - 1][l0] == k) {
            Update(best[i2][l0 | 1] + s, l0 | 1, i, j, k, i1);
          } else {
            Update(best[i2][l0] + s, l0, i, j, k, i1);
          }
        }
      }
  }
  int rt, Min = 0x7fffffff;
  for (int i = 0; i < 26; ++i)
    if (best[i2][i << 1] < Min) {
      Min = best[i2][i << 1], rt = i << 1;
    }
  re[n] = rt;
  for (int i = n; i > 1; --i) {
    rt = path[i][rt], re[i - 1] = rt;
  }
  printf("%d\n", Min);
  for (int i = 1, l; i <= n; ++i) {
    l = re[i] >> 1;
    for (int j = 0; j < m; ++j) {
      if (j & 1)
        putchar(ch[id[i][re[i]]]);
      else
        putchar(ch[l]);
    }
    puts("");
  }
  return 0;
}
