#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:128000000")
template <class T>
inline T sqr(T x) {
  return x * x;
}
int n, m;
char a[512][512];
int d[500][26][26];
int c[500][26][2];
int cost[500][26][26];
vector<pair<int, pair<int, int> > > cur;
pair<int, int> p[500][26][26];
int main() {
  scanf("%d%d\n", &n, &m);
  for (int i = 0; i < n; ++i) {
    gets(a[i]);
    for (int j = 0; j < m; ++j) ++c[i][a[i][j] - 'a'][j & 1];
    for (int c1 = 0; c1 < 26; ++c1) {
      for (int c2 = 0; c2 < 26; ++c2) {
        if (c1 == c2) continue;
        cost[i][c1][c2] = m - c[i][c1][0] - c[i][c2][1];
      }
    }
  }
  memset(d, 127, sizeof d);
  memcpy(d[n - 1], cost[n - 1], sizeof d[n - 1]);
  for (int i = n - 2; i >= 0; --i) {
    cur.clear();
    for (int c1 = 0; c1 < 26; ++c1) {
      for (int c2 = 0; c2 < 26; ++c2) {
        if (c1 == c2) continue;
        cur.push_back(make_pair(d[i + 1][c1][c2], make_pair(c1, c2)));
      }
    }
    sort((cur).begin(), (cur).end());
    for (int c1 = 0; c1 < 26; ++c1) {
      for (int c2 = 0; c2 < 26; ++c2) {
        if (c1 == c2) continue;
        for (int j = 0; j < (int)((cur).size()); ++j) {
          if (c1 == cur[j].second.first || c2 == cur[j].second.second) continue;
          d[i][c1][c2] = cur[j].first + cost[i][c1][c2];
          p[i][c1][c2] = cur[j].second;
          break;
        }
      }
    }
  }
  int res = INT_MAX, bi, bj;
  for (int c1 = 0; c1 < 26; ++c1) {
    for (int c2 = 0; c2 < 26; ++c2) {
      if (c1 == c2) continue;
      int tmp = d[0][c1][c2];
      if (res > tmp) res = tmp, bi = c1, bj = c2;
    }
  }
  printf("%d\n", res);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) printf("%c", ((j & 1) ? bj : bi) + 'a');
    puts("");
    pair<int, int> next = p[i][bi][bj];
    bi = next.first, bj = next.second;
  }
  return 0;
}
