#include <bits/stdc++.h>
char q1[505][505], q2[505][3];
int dp[505][30][30];
int num[505][30][30];
int aaa[505][30][30], bbb[505][30][30];
int n, j, k, i, l, m, aa, bb;
int main() {
  scanf("%d %d", &n, &m);
  getchar();
  for (i = 0; i < n; i++) {
    gets(q1[i]);
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < 26; j++) {
      for (l = 0; l < 26; l++) {
        int a = 0;
        if (j == l) continue;
        for (k = 0; k < m; k += 2)
          if (q1[i][k] - 'a' != j) a++;
        for (k = 1; k < m; k += 2)
          if (q1[i][k] - 'a' != l) a++;
        num[i][j][l] = a;
      }
    }
  }
  int ans = 1 << 30;
  for (i = 0; i < n; i++) {
    for (j = 0; j < 26; j++) {
      for (l = 0; l < 26; l++) {
        dp[i][j][l] = 1 << 30;
      }
    }
  }
  for (j = 0; j < 26; j++) {
    for (l = 0; l < 26; l++) {
      dp[0][j][l] = num[0][j][l];
    }
  }
  for (i = 0; i < n - 1; i++) {
    for (j = 0; j < 26; j++) {
      for (l = 0; l < 26; l++) {
        if (j == l) continue;
        for (aa = 0; aa < 26; aa++) {
          for (bb = 0; bb < 26; bb++) {
            if (aa == bb) continue;
            if (aa == j || bb == l) continue;
            if (dp[i][j][l] + num[i + 1][aa][bb] < dp[i + 1][aa][bb]) {
              dp[i + 1][aa][bb] = dp[i][j][l] + num[i + 1][aa][bb];
              aaa[i + 1][aa][bb] = j;
              bbb[i + 1][aa][bb] = l;
            }
          }
        }
      }
    }
  }
  int t1, t2, s1, s2;
  for (i = 0; i < 26; i++) {
    for (j = 0; j < 26; j++) {
      if (i == j) continue;
      if (ans > dp[n - 1][i][j]) {
        s1 = i;
        t1 = j;
        ans = dp[n - 1][i][j];
      }
    }
  }
  for (i = n - 1; i >= 0; i--, s1 = s2, t1 = t2) {
    q2[i][0] = 'a' + s1;
    q2[i][1] = 'a' + t1;
    s2 = aaa[i][s1][t1];
    t2 = bbb[i][s1][t1];
  }
  printf("%d\n", ans);
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      printf("%c", q2[i][j % 2]);
    }
    printf("\n");
  }
}
