#include <bits/stdc++.h>
using namespace std;
const int N = (int)5e2 + 7;
const int C = (int)2e1 + 6;
int dp[2][C][C];
pair<int, int> p[N][C][C];
set<pair<int, int>> w[2][C];
string a[N];
int get(string& s, int x, int y) {
  int ans = 0;
  for (int i = 0; i < (int)s.size(); i++) {
    if (i % 2 == 0)
      if (s[i] - 'a' != x) ans++;
    if (i % 2 == 1)
      if (s[i] - 'a' != y) ans++;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans = INT_MAX, fx = 0, fy = 0;
  for (int x = 0; x < C; x++) {
    for (int y = 0; y < C; y++) {
      if (x != y) {
        w[0][x].insert({get(a[0], x, y), y});
        if (n == 1) {
          if (get(a[0], x, y) < ans) {
            ans = get(a[0], x, y);
            fx = x, fy = y;
          }
        }
      }
    }
  }
  for (int i = 1; i < n; i++) {
    for (int z = 0; z < C; z++) w[i & 1][z].clear();
    for (int x = 0; x < C; x++) {
      for (int y = 0; y < C; y++) {
        if (x == y) continue;
        int cur = (i & 1), res = INT_MAX, anc_x = -1, anc_y = -1;
        for (int wx = 0; wx < C; wx++) {
          if (wx == x || w[cur ^ 1][wx].empty()) continue;
          auto it = w[cur ^ 1][wx].begin();
          if ((it->second) == y) it++;
          if (it != w[cur ^ 1][wx].end()) {
            if ((it->first) < res) {
              res = (it->first);
              anc_x = wx, anc_y = (it->second);
            }
          }
        }
        if (res == INT_MAX) continue;
        res = res + get(a[i], x, y);
        w[cur][x].insert({res, y});
        p[i][x][y] = {anc_x, anc_y};
        if (i == n - 1) {
          if (res < ans) {
            ans = res;
            fx = x, fy = y;
          }
        }
      }
    }
  }
  cout << ans << '\n';
  vector<string> final;
  for (int i = n - 1; i >= 0; i--) {
    string cur;
    for (int i = 0; i < m; i++) {
      if (i & 1)
        cur += char(fy + 'a');
      else
        cur += char(fx + 'a');
    }
    final.push_back(cur);
    pair<int, int> now = p[i][fx][fy];
    fx = now.first, fy = now.second;
  }
  reverse(final.begin(), final.end());
  for (auto x : final) cout << x << '\n';
  return 0;
}
