#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!(isdigit(ch))) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  return x * f;
}
long long dp[501][30][30];
struct Node {
  long long x, b;
} f[501][30][30];
char c[501][501];
long long n, m;
inline long long cal(long long x, long long a, long long b) {
  char A = a + 'a', B = b + 'a';
  long long ans = 0;
  for (long long i = 1; i <= m; i++) {
    if (i & 1)
      ans += (c[x][i] != A);
    else
      ans += (c[x][i] != B);
  }
  return ans;
}
inline void Dp() {
  memset(dp, 0x3f, sizeof dp);
  for (long long A = 0; A < 26; A++)
    for (long long B = 0; B < 26; B++)
      if (A != B) dp[1][A][B] = cal(1, A, B);
  for (long long i = 2; i <= n; i++)
    for (long long A = 0; A < 26; A++)
      for (long long B = 0; B < 26; B++) {
        if (A == B) continue;
        long long tmp = cal(i, A, B);
        for (long long a = 0; a < 26; a++) {
          if (a == A) continue;
          for (long long b = 0; b < 26; b++) {
            if (b == B) continue;
            if (a == b) continue;
            if (dp[i - 1][a][b] == 2147483647) continue;
            if (dp[i][A][B] > dp[i - 1][a][b] + tmp) {
              dp[i][A][B] = dp[i - 1][a][b] + tmp;
              f[i][A][B].x = a;
              f[i][A][B].b = b;
            }
          }
        }
      }
  long long ans = 2147483647, A, B;
  for (long long i = 0; i < 26; i++)
    for (long long j = 0; j < 26; j++)
      if (ans > dp[n][i][j]) {
        ans = dp[n][i][j];
        A = i;
        B = j;
      }
  printf("%d\n", ans);
  for (long long i = n; i >= 1; i--) {
    for (long long j = 1; j <= m; j++) {
      if (j & 1)
        c[i][j] = A + 'a';
      else
        c[i][j] = B + 'a';
    }
    long long a = A, b = B;
    A = f[i][a][b].x;
    B = f[i][a][b].b;
  }
  for (long long i = 1; i <= n; i++) printf("%s\n", c[i] + 1);
}
signed main() {
  n = read();
  m = read();
  for (long long i = 1; i <= n; i++) scanf("%s", c[i] + 1);
  Dp();
  return 0;
}
