#include <bits/stdc++.h>
using namespace std;
const int N = 500 + 4, Z = 26 + 4;
char ar[N][N];
int n, m, mn = 1e9, dp[N][Z][Z], d[N][2][Z];
vector<pair<int, pair<int, int> > > v[N];
vector<string> ans;
pair<int, int> par[N][Z][Z];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> ar[i][j];
      d[i][j & 1][ar[i][j] - 'a']++;
    }
  }
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < 26; j++) {
      dp[0][i][j] = m - d[0][0][i] - d[0][1][j];
      v[0].push_back(
          pair<int, pair<int, int> >(dp[0][i][j], pair<int, int>(i, j)));
    }
  }
  sort(v[0].begin(), v[0].end());
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < 26; j++) {
      for (int k = 0; k < 26; k++) {
        for (int z = 0; z < 58; z++) {
          if ((v[i - 1][z].second.first != j) &&
              (v[i - 1][z].second.second != k) &&
              v[i - 1][z].second.first != v[i - 1][z].second.second) {
            dp[i][j][k] = v[i - 1][z].first + (m - d[i][0][j] - d[i][1][k]);
            par[i][j][k] = pair<int, int>(v[i - 1][z].second.first,
                                          v[i - 1][z].second.second);
            break;
          }
        }
        v[i].push_back(
            pair<int, pair<int, int> >(dp[i][j][k], pair<int, int>(j, k)));
      }
    }
    sort(v[i].begin(), v[i].end());
  }
  int x, y;
  for (int i = 0; i < 26; i++)
    for (int j = 0; j < 26; j++)
      if (i != j && dp[n - 1][i][j] < mn) {
        mn = dp[n - 1][i][j];
        x = i;
        y = j;
      }
  cout << mn << endl;
  for (int t = n - 1; t >= 0; t--) {
    string s;
    for (int j = 0; j < m; j++) {
      if (j & 1)
        s += (char)(y + 'a');
      else
        s += (char)(x + 'a');
    }
    int tmp = x;
    x = par[t][x][y].first;
    y = par[t][tmp][y].second;
    ans.push_back(s);
  }
  reverse(ans.begin(), ans.end());
  for (string i : ans) cout << i << endl;
}
