#include <bits/stdc++.h>
using namespace std;
bool endline = false;
template <class T>
istream& operator>>(istream& inp, vector<T>& v) {
  for (auto& it : v) inp >> it;
  return inp;
}
template <class T>
ostream& operator<<(ostream& out, vector<T>& v) {
  for (auto& it : v) out << it << (endline ? "\n" : " ");
  return out;
}
template <class T, class U>
istream& operator>>(istream& inp, pair<T, U>& v) {
  inp >> v.first >> v.second;
  return inp;
}
template <class T, class U>
ostream& operator<<(ostream& out, pair<T, U>& v) {
  out << v.first << ' ' << v.second;
  return out;
}
const int mod1 = 998244353, mod = 1e9 + 7;
const int MAXN = 1e5 + 5, MAXM = 3e5 + 5;
const int inf = 2e9;
const long long linf = 1e18;
long long n, m, cnt[2][26];
long long dp[505][26 * 26];
long long tr[505][26 * 26];
void Solve() {
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j < 26; j++) {
      cnt[0][j] = cnt[1][j] = 0;
    }
    for (long long j = 0; j < m; j++) {
      char c;
      cin >> c;
      cnt[j % 2][c - 'a']++;
    }
    for (long long j = 0; j < 26 * 26; j++) {
      for (long long k = 0; k < 26 * 26; k++) {
        long long a00 = j / 26, a01 = j % 26, a10 = k / 26, a11 = k % 26;
        if (a00 == a01 || a01 == a11 || a11 == a10 || a10 == a00) continue;
        if (dp[i][j] < dp[i - 1][k] + cnt[0][a00] + cnt[1][a01]) {
          dp[i][j] = dp[i - 1][k] + cnt[0][a00] + cnt[1][a01];
          tr[i][j] = k;
        }
      }
    }
  }
  long long res = 0, p = 1;
  vector<string> ans;
  for (long long i = 0; i < 26 * 26; i++) {
    if ((i / 26) != (i % 26) && res < dp[n][i]) {
      res = dp[n][i];
      p = i;
    }
  }
  cout << m * n - res << endl;
  for (long long i = n; i >= 1; i--) {
    long long a = p / 26, b = p % 26;
    string tmp = "";
    for (long long j = 0; j < m; j++) {
      tmp += (j % 2 == 0 ? a : b) + 'a';
    }
    p = tr[i][p];
    ans.push_back(tmp);
  }
  reverse(ans.begin(), ans.end());
  for (long long i = 0; i < n; i++) {
    cout << ans[i] << endl;
  }
}
signed main() {
  if (fopen("40"
            ".inp",
            "r")) {
    freopen(
        "40"
        ".inp",
        "r", stdin);
    freopen(
        "40"
        ".out",
        "w", stdout);
  };
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long TC = 1;
  while (TC--) Solve();
  return 0;
}
