#include <bits/stdc++.h>
using namespace std;
int n, m;
int dp[501][31][31];
int pre[501][26][2];
vector<string> mat;
int mo, me;
vector<pair<int, int> > result;
int min(int i, int j) {
  if (i <= j) return i;
  return j;
}
int getMin(int ind, int c1, int c2) {
  if (ind == n) return 0;
  int& ret = dp[ind][c1][c2];
  if (ret != -1) return ret;
  ret = 1e9;
  int r1 = 0;
  for (int i = 0; i < 26; i++) {
    for (char j = 0; j < 26; j++) {
      if (i == j || !(i != c1 && j != c2)) continue;
      r1 = me - pre[ind][i][0];
      r1 += mo - pre[ind][j][1];
      ret = min(ret, r1 + getMin(ind + 1, i, j));
    }
  }
  return ret;
}
void buildPath(int ind, int c1, int c2) {
  if (ind == n) return;
  int& ret = dp[ind][c1][c2];
  int r1 = 0, tem;
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < 26; j++) {
      if (i == j || !(i != c1 && j != c2)) continue;
      r1 = me - pre[ind][i][0];
      r1 += mo - pre[ind][j][1];
      if (ret == r1 + getMin(ind + 1, i, j)) {
        result.push_back(make_pair(i, j));
        buildPath(ind + 1, i, j);
        return;
      }
    }
  }
}
int main() {
  cin >> n >> m;
  me = m / 2 + (m & 1);
  mo = m / 2;
  mat = vector<string>(n);
  memset(dp, -1, sizeof dp);
  for (int i = 0; i < n; i++) {
    cin >> mat[i];
    bool f = 0;
    for (int j = 0; j < mat[i].size(); j++) {
      pre[i][mat[i][j] - 'a'][f]++;
      f = !f;
    }
  }
  int res = getMin(0, 30, 30);
  cout << res << endl;
  buildPath(0, 30, 30);
  for (int k = 0; k < n; k++) {
    bool f = 0;
    for (int l = 0; l < m; l++) {
      if (!f)
        cout << char(result[k].first + 'a');
      else
        cout << char(result[k].second + 'a');
      f = !f;
    }
    cout << endl;
  }
  return 0;
}
