#include <bits/stdc++.h>
using namespace std;
struct debugger {
  template <typename T>
  debugger& operator,(const T& v) {
    cerr << v << " ";
    return *this;
  }
} debug;
template <typename T1, typename T2>
inline ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
inline ostream& operator<<(ostream& os, const vector<T>& v) {
  bool first = true;
  os << "[";
  for (typename vector<T>::const_iterator ii = v.begin(); ii != v.end(); ++ii) {
    if (!first) os << ", ";
    os << *ii;
    first = false;
  }
  return os << "]";
}
const int NN = 500;
const int alpha = 26;
const int INF = 10000000;
int dp[NN][alpha][alpha], cnt[NN][alpha][2];
int nxt[NN][alpha][alpha][2];
string A[NN];
void build(int n, int m) {
  if (m <= 1) {
    for (int row = n - 1; row >= 0; --row)
      for (int p1 = 0; p1 < alpha; ++p1) {
        int ans = INF, x1;
        for (int i = 0; i < alpha; ++i) {
          if ((row != 0) and (i == p1)) continue;
          int add = cnt[row][i][0];
          int temp = add + dp[row + 1][i][0];
          if (temp < ans) ans = temp, x1 = i;
        }
        dp[row][p1][0] = ans;
        nxt[row][p1][0][0] = x1;
      }
    return;
  }
  for (int row = n - 1; row >= 0; --row)
    for (int p1 = 0; p1 < alpha; ++p1)
      for (int p2 = 0; p2 < alpha; ++p2) {
        if (p1 == p2) continue;
        int ans = INF, x1, x2;
        for (int i = 0; i < alpha; ++i) {
          if (row != 0 and i == p1) continue;
          for (int j = 0; j < alpha; ++j) {
            if ((i == j) or (row != 0 and j == p2)) continue;
            int add = cnt[row][i][0] + cnt[row][j][1];
            int temp = add + dp[row + 1][i][j];
            if (temp < ans) ans = temp, x1 = i, x2 = j;
          }
        }
        dp[row][p1][p2] = ans;
        nxt[row][p1][p2][0] = x1;
        nxt[row][p1][p2][1] = x2;
      }
}
void solve() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> A[i];
  for (int i = 0; i < n; ++i)
    for (int k = 0; k < alpha; ++k)
      for (int p = 0; p < 2; ++p)
        for (int j = p; j < m; j += 2)
          cnt[i][k][p] += (((int)(A[i][j] - 'a')) != k);
  build(n, m);
  int p1 = 0, p2 = (m > 1);
  int ans = dp[0][p1][p2];
  cout << ans << endl;
  for (int i = 0; i < n; ++i) {
    string op = "";
    int x1 = nxt[i][p1][p2][0], x2 = nxt[i][p1][p2][1];
    p1 = x1, p2 = x2;
    for (int j = 0; j < m; ++j) {
      int add = (j & 1) ? p2 : p1;
      op.push_back((char)('a' + add));
    }
    cout << op << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  solve();
  return 0;
}
