#include <bits/stdc++.h>
using namespace std;
char mp[505][505];
int c[505][27][27], dp[505][27][27];
pair<int, int> pre[505][27][27];
int n, m;
void init() {
  memset(c, 0, sizeof(c));
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < 26; j++) {
      for (int k = 0; k < n; k++) {
        for (int s = 0; s < m; s++) {
          if ((s & 1) == 0) {
            if (mp[k][s] - 'a' != i) c[k][i][j]++;
          } else {
            if (mp[k][s] - 'a' != j) c[k][i][j]++;
          }
        }
      }
    }
  }
}
int main() {
  int i, j;
  while (scanf("%d%d", &n, &m) != EOF) {
    for (i = 0; i < n; i++) {
      scanf("%s", mp[i]);
    }
    init();
    memset(dp, 0x7f, sizeof(dp));
    for (i = 0; i < 26; i++) {
      for (j = 0; j < 26; j++) {
        if (j == i) continue;
        dp[0][i][j] = c[0][i][j];
      }
    }
    for (int k = 1; k < n; k++) {
      for (i = 0; i < 26; i++) {
        for (j = 0; j < 26; j++) {
          if (j == i) continue;
          for (int ii = 0; ii < 26; ii++) {
            if (ii == i) continue;
            for (int jj = 0; jj < 26; jj++) {
              if (jj == j) continue;
              if (jj == ii) continue;
              if (dp[k - 1][i][j] + c[k][ii][jj] < dp[k][ii][jj]) {
                dp[k][ii][jj] = dp[k - 1][i][j] + c[k][ii][jj];
                pre[k][ii][jj] = make_pair(i, j);
              }
            }
          }
        }
      }
    }
    int ans = 1 << 30, x, y;
    for (i = 0; i < 26; i++) {
      for (j = 0; j < 26; j++) {
        if (ans > dp[n - 1][i][j]) {
          ans = dp[n - 1][i][j];
          x = i;
          y = j;
        }
      }
    }
    printf("%d\n", ans);
    for (i = n - 1; i >= 0; i--) {
      for (j = 0; j < m; j++) {
        if ((j & 1) == 0) {
          mp[i][j] = x + 'a';
        } else {
          mp[i][j] = y + 'a';
        }
      }
      int tx = x, ty = y;
      x = pre[i][tx][ty].first;
      y = pre[i][tx][ty].second;
    }
    for (i = 0; i < n; i++) {
      printf("%s\n", mp[i]);
    }
  }
  return 0;
}
