#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 5e2 + 10, Z = 26, OO = 1e9 + 7;
int n, m, ans = 1e9 + 7;
int Count[MAXN][Z][2];
int dp[MAXN][Z][Z];
string table[MAXN];
pair<int, int> par[MAXN][Z][Z];
vector<pair<int, pair<int, int> > > v, u;
pair<int, int> TABLE[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> table[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) Count[i][table[i][j] - 'a'][j % 2]++;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < Z; j++) memset(dp[i][j], 127, sizeof(dp[i][j]));
  for (int i = 0; i < Z; i++)
    for (int j = 0; j < Z; j++)
      if (i != j) dp[0][i][j] = m - Count[0][i][0] - Count[0][j][1];
  for (int i = 0; i < Z; i++)
    for (int j = 0; j < Z; j++) v.push_back({dp[0][i][j], {i, j}});
  sort(v.begin(), v.end());
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < Z; j++)
      for (int k = 0; k < Z; k++)
        if (j != k) {
          int ind = 0;
          while (v[ind].second.first == j || v[ind].second.second == k) ind++;
          dp[i][j][k] = v[ind].first + m - Count[i][j][0] - Count[i][k][1];
          par[i][j][k] = {v[ind].second.first, v[ind].second.second};
          u.push_back({dp[i][j][k], {j, k}});
        }
    v = u;
    u.clear();
    sort(v.begin(), v.end());
  }
  int x = 0, y = 0;
  for (int i = 0; i < Z; i++)
    for (int j = 0; j < Z; j++)
      if (dp[n - 1][i][j] < dp[n - 1][x][y]) {
        x = i;
        y = j;
      }
  cout << dp[n - 1][x][y] << "\n";
  int row = n - 1;
  while (~row) {
    TABLE[row] = {x, y};
    int X, Y;
    tie(X, Y) = par[row][x][y];
    x = X;
    y = Y;
    row--;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++)
      cout << char((j % 2 ? TABLE[i].second : TABLE[i].first) + 'a');
    cout << "\n";
  }
}
