#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500 + 30, INF = 1000 * 1000 * 1000;
int flag[MAXN][MAXN];
int flag2[MAXN][MAXN];
int o[MAXN][26];
int e[MAXN][26];
int dp[MAXN][26][26][3];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < m; j++) {
      flag[i][j] = s[j] - 'a';
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (j % 2 == 0) {
        e[i][flag[i][j]]++;
      } else {
        o[i][flag[i][j]]++;
      }
    }
  }
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < 26; j++) {
      dp[0][i][j][1] = -1;
      dp[0][i][j][2] = -1;
      if (i == j) {
        dp[0][i][j][0] = INF;
      } else {
        dp[0][i][j][0] = ((m + 1) / 2) - o[0][i] + (m / 2) - e[0][j];
      }
    }
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < 26; j++) {
      for (int k = 0; k < 26; k++) {
        dp[i][j][k][0] = INF;
        dp[i][j][k][1] = -1;
        dp[i][j][k][2] = -1;
        if (j != k) {
          int base = ((m + 1) / 2) - o[i][j] + (m / 2) - e[i][k];
          for (int h = 0; h < 26; h++) {
            for (int g = 0; g < 26; g++) {
              if (h == j || k == g) {
                continue;
              }
              if (dp[i][j][k][0] > base + dp[i - 1][h][g][0]) {
                dp[i][j][k][0] = base + dp[i - 1][h][g][0];
                dp[i][j][k][1] = h;
                dp[i][j][k][2] = g;
              }
            }
          }
        }
      }
    }
  }
  int ans = INF;
  int ansi = -1, ansj = -1;
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < 26; j++) {
      if (ans > dp[n - 1][i][j][0]) {
        ans = dp[n - 1][i][j][0];
        ansi = i;
        ansj = j;
      }
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < m; j++) {
      if (j % 2 == 0) {
        flag2[i][j] = ansj;
      } else {
        flag2[i][j] = ansi;
      }
    }
    int temp = dp[i][ansi][ansj][2];
    ansi = dp[i][ansi][ansj][1];
    ansj = temp;
  }
  cout << ans << endl;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << (char)(flag2[i][j] + 'a');
    }
    cout << endl;
  }
  return 0;
}
