#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline string get() {
  char ch[1000010];
  scanf("%s", ch);
  return ch;
}
const int MAX_LG = 21;
const int maxn = 500 + 10;
const int state = 1e3 + 10;
const int base = 29;
const int mod = 1e9 + 7;
const int INF = 1e9;
string s[maxn];
int save, p[maxn], cnt[maxn], dp[maxn][27][27];
bool mark[30];
pair<int, int> cur;
pair<int, int> pre[maxn][27][27];
int grid[maxn][maxn];
int res = INF;
int32_t main() {
  int n = in(), m = in();
  for (int i = 0; i < n; i++) {
    s[i] = get();
    save = s[i][0] - 'a';
    for (int x = 0; x < m; x++) mark[s[i][x] - 'a'] = true;
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 27; j++)
      for (int k = 0; k < 27; k++) dp[i][j][k] = INF;
  for (int x1 = 0; x1 < 26; x1++) {
    for (int x2 = 0; x2 < 26; x2++) {
      if ((x1 == x2 && m > 1)) continue;
      int cnt = 0;
      for (int j = 0; j < m; j++) {
        cnt += ((j % 2 == 0 && s[0][j] - 'a' != x1) ||
                (j % 2 && s[0][j] - 'a' != x2));
      }
      if (dp[0][x1][x2] > cnt) dp[0][x1][x2] = cnt;
      if (0 == n - 1 && cnt < res) res = cnt, cur = {x1, x2};
    }
  }
  for (int i = 1; i < n; i++) {
    for (int x1 = 0; x1 < 26; x1++) {
      for (int x2 = 0; x2 < 26; x2++) {
        if ((x2 == x1 && m > 1)) continue;
        int cnt = 0;
        for (int j = 0; j < m; j++)
          cnt += ((j % 2 == 0 && s[i][j] - 'a' != x1) ||
                  (j % 2 && s[i][j] - 'a' != x2));
        int scnt = cnt;
        for (int pr1 = 0; pr1 < 26; pr1++) {
          for (int pr2 = 0; pr2 < 26; pr2++) {
            if (x1 == pr1 || x2 == pr2) continue;
            cnt = scnt + dp[i - 1][pr1][pr2];
            if (cnt < dp[i][x1][x2])
              dp[i][x1][x2] = cnt, pre[i][x1][x2] = {pr1, pr2};
            if (i == n - 1 && cnt < res) res = cnt, cur = {x1, x2};
          }
        }
      }
    }
  }
  int row = n - 1;
  while (row >= 0) {
    for (int j = 0; j < m; j++)
      grid[row][j] = (j % 2 == 0 ? cur.first : cur.second);
    cur = pre[row][cur.first][cur.second], row--;
  }
  cout << res << "\n";
  for (int i = 0; i < n; i++, cout << "\n") {
    for (int j = 0; j < m; j++) {
      cout << char(grid[i][j] + 'a');
    }
  }
}
