#include <bits/stdc++.h>
using namespace std;
int cost[2][26][505];
array<array<int, 26>, 26> dp[505];
int from[505][26 * (1 << 5) + 27];
array<array<int, 26>, 26> ds[4];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<string> a(n);
  for (auto &i : a) cin >> i;
  for (int p = 0; p < 2; ++p)
    for (int j = 0; j < 26; ++j)
      for (int k = 0; k < n; ++k)
        for (int i = p; i < m; i += 2) cost[p][j][k] += a[k][i] != (j + 'a');
  for (int i = 0; i < 26; ++i) dp[0][i][i] = 1 << 30;
  const int mask = (1 << 5) - 1;
  for (int k = 0; k < n; ++k) {
    auto best = [&](int x, int &y) {
      if (y == -1 || dp[k][x >> 5][x & mask] < dp[k][y >> 5][y & mask]) y = x;
    };
    for (int i = 0; i < 26; ++i)
      for (int j = 0; j < 26; ++j) {
        ds[0][i][j] = i << 5 | j;
        if (i) best(ds[0][i - 1][j], ds[0][i][j]);
        if (j) best(ds[0][i][j - 1], ds[0][i][j]);
      }
    for (int i = 0; i < 26; ++i)
      for (int j = 25; j >= 0; --j) {
        ds[1][i][j] = i << 5 | j;
        if (i) best(ds[1][i - 1][j], ds[1][i][j]);
        if (j + 1 < 26) best(ds[1][i][j + 1], ds[1][i][j]);
      }
    for (int i = 25; i >= 0; --i)
      for (int j = 0; j < 26; ++j) {
        ds[2][i][j] = i << 5 | j;
        if (i + 1 < 26) best(ds[2][i + 1][j], ds[2][i][j]);
        if (j) best(ds[2][i][j - 1], ds[2][i][j]);
      }
    for (int i = 25; i >= 0; --i)
      for (int j = 25; j >= 0; --j) {
        ds[3][i][j] = i << 5 | j;
        if (i + 1 < 26) best(ds[3][i + 1][j], ds[3][i][j]);
        if (j + 1 < 26) best(ds[3][i][j + 1], ds[3][i][j]);
      }
    for (int i = 0; i < 26; ++i)
      for (int j = 0; j < 26; ++j) {
        if (i == j) {
          dp[k + 1][i][i] = 1 << 30;
          continue;
        }
        int pos = -1;
        if (i && j) best(ds[0][i - 1][j - 1], pos);
        if (i && j + 1 < 26) best(ds[1][i - 1][j + 1], pos);
        if (i + 1 < 26 && j) best(ds[2][i + 1][j - 1], pos);
        if (i + 1 < 26 && j + 1 < 26) best(ds[3][i + 1][j + 1], pos);
        dp[k + 1][i][j] =
            dp[k][pos >> 5][pos & mask] + cost[0][i][k] + cost[1][j][k];
        from[k + 1][i << 5 | j] = pos;
      }
  }
  int pos = 0;
  for (int i = 0; i < 26; ++i)
    for (int j = 0; j < 26; ++j)
      if (dp[n][i][j] < dp[n][pos >> 5][pos & mask]) pos = i << 5 | j;
  cout << dp[n][pos >> 5][pos & mask] << "\n";
  for (int i = n; i > 0; --i) {
    char x = (pos >> 5) + 'a';
    char y = (pos & mask) + 'a';
    for (int j = 0; j < m; j += 2) a[i - 1][j] = x;
    for (int j = 1; j < m; j += 2) a[i - 1][j] = y;
    pos = from[i][pos];
  }
  for (auto &i : a) cout << i << "\n";
  return 0;
}
