#include <bits/stdc++.h>
using namespace std;
const int INFINITE = 0x3f3f3f3f;
char grid[500][501];
int m, n;
int memo[500][27][27][2], memoCost[500][27][2];
bool mark[500][27][27][2], markCost[500][27][2];
int choice[500][27][27][2];
int GetCost(int row, char c, int next) {
  int& cost = memoCost[row][c][next];
  if (markCost[row][c][next]) return cost;
  cost = 0, markCost[row][c][next] = true;
  for (int j = next; j < n; j += 2)
    if (grid[row][j] != c + 'a') ++cost;
  return cost;
}
int f(int row, int c1, int c2, int next) {
  if (row >= m) return 0;
  int& best = memo[row][c1][c2][next];
  int& ch = choice[row][c1][c2][next];
  if (mark[row][c1][c2][next]) return best;
  best = INFINITE, mark[row][c1][c2][next] = true;
  if (next == 0) {
    for (int nc1 = 0; nc1 < 26; ++nc1)
      if (nc1 != c1) {
        const int cost = GetCost(row, nc1, next);
        const int sub = f(row, nc1, c2, 1 - next) + cost;
        if (sub < best) best = sub, ch = nc1;
      }
  } else {
    for (int nc2 = 0; nc2 < 26; ++nc2)
      if (nc2 != c1 && nc2 != c2) {
        const int cost = GetCost(row, nc2, next);
        const int sub = f(row + 1, c1, nc2, 1 - next) + cost;
        if (sub < best) best = sub, ch = nc2;
      }
  }
  return best;
}
void UpdateFlag() {
  for (int row = 0, c1 = 26, c2 = 26, next = 0; row < m;) {
    const int nc = choice[row][c1][c2][next];
    for (int j = next; j < n; j += 2) grid[row][j] = nc + 'a';
    if (next == 0)
      c1 = nc, next = 1;
    else
      c2 = nc, next = 0, ++row;
  }
}
int main() {
  scanf("%d %d", &m, &n);
  for (int i = 0; i < m; ++i) scanf("%s", grid[i]);
  memset(mark, false, sizeof(mark));
  memset(markCost, false, sizeof(markCost));
  printf("%d\n", f(0, 26, 26, 0));
  UpdateFlag();
  for (int i = 0; i < m; ++i) printf("%s\n", grid[i]);
  return 0;
}
