#include <bits/stdc++.h>
using namespace std;
const int MAXX = 5e3 + 10, inf = 1e9 + 10;
int n, m, dp[MAXX][30][30], res[MAXX][30][30], mn, x1, x2;
pair<int, int> par[MAXX][30][30];
string s[MAXX];
vector<string> v;
inline void upd(int i, int x, int y) {
  int mn_res = inf;
  dp[i][x][y] = inf;
  for (int j = 0; j < 26; j++)
    for (int k = 0; k < 26; k++)
      if (j != k && j != x && k != y) {
        dp[i][x][y] = min(dp[i][x][y], dp[i - 1][j][k] + res[i][x][y]);
        if (mn_res > dp[i - 1][j][k] + res[i][x][y])
          mn_res = dp[i - 1][j][k] + res[i][x][y], par[i][x][y] = {j, k};
      }
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  memset(dp, inf, sizeof dp);
  for (int i = 1; i <= n; i++) cin >> s[i], s[i] = ' ' + s[i];
  for (int i = 0; i < 26; i++)
    for (int j = 0; j < 26; j++) dp[0][i][j] = 0;
  for (int r = 1; r <= n; r++)
    for (int j = 0; j < 26; j++)
      for (int k = 0; k < 26; k++)
        for (int i = 1; i <= m; i++) {
          if ((i & 1) && (s[r][i] - 'a') != j) res[r][j][k]++;
          if (!(i & 1) && (s[r][i] - 'a') != k) res[r][j][k]++;
        }
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < 26; j++)
      for (int k = 0; k < 26; k++)
        if (j != k) upd(i, j, k);
  mn = inf;
  for (int i = 0; i < 26; i++)
    for (int j = 0; j < 26; j++)
      if (i != j && dp[n][i][j] < mn) mn = dp[n][i][j], x1 = i, x2 = j;
  cout << mn << endl;
  int x = n;
  while (x) {
    string s = "";
    for (int i = 1; i <= m; i++)
      s += ((i & 1) ? char(x1 + 'a') : char(x2 + 'a'));
    v.push_back(s);
    int curr1 = x1;
    int curr2 = x2;
    x1 = par[x][curr1][curr2].first, x2 = par[x][curr1][curr2].second;
    x--;
  }
  reverse(v.begin(), v.end());
  for (auto x : v) cout << x << endl;
}
