#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[1000][1000];
int odd[1000][30];
int even[1000][30];
int mas[30][30][1000];
int went[30][30][1000][2];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char ch;
      cin >> ch;
      a[i][j] = ch - 'a';
      if (j % 2) {
        odd[i][a[i][j]]++;
      } else {
        even[i][a[i][j]]++;
      }
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int k1 = 0; k1 < 26; k1++) {
      for (int k2 = 0; k2 < 26; k2++) {
        if (k1 == k2) continue;
        mas[k1][k2][i] = 1000 * 1000;
        for (int k3 = 0; k3 < 26; k3++) {
          if (k3 == k1) continue;
          for (int k4 = 0; k4 < 26; k4++) {
            if (k4 == k2 || k4 == k3) continue;
            int t = m - odd[i][k4] - even[i][k3] + mas[k3][k4][i + 1];
            if (t < mas[k1][k2][i]) {
              mas[k1][k2][i] = t;
              went[k1][k2][i][0] = k3;
              went[k1][k2][i][1] = k4;
            }
          }
        }
      }
    }
  }
  int minv = 1000 * 1000, mink1, mink2;
  for (int i = 0; i >= 0; i--) {
    for (int k1 = 0; k1 < 26; k1++) {
      for (int k2 = 0; k2 < 26; k2++) {
        if (k1 == k2) continue;
        if (mas[k1][k2][0] < minv) {
          minv = mas[k1][k2][0];
          mink1 = k1;
          mink2 = k2;
        }
      }
    }
  }
  cout << minv << endl;
  int k1 = mink1, k2 = mink2;
  for (int i = 0; i < n; i++) {
    int t1 = went[k1][k2][i][0];
    int t2 = went[k1][k2][i][1];
    k1 = t1, k2 = t2;
    for (int j = 0; j < m; j++) {
      if (j % 2)
        cout << (char)(k2 + 'a');
      else
        cout << (char)(k1 + 'a');
    }
    cout << endl;
  }
  return 0;
}
