#include <bits/stdc++.h>
using namespace std;
typedef long double real;
string Pair[26][26];
int cost[26][26][501], dp[26][26][501];
pair<int, int> parent[26][26][501];
int n, m;
char flag[501][501];
pair<int, pair<int, int> > buffer[26 * 26];
bool used[26][26];
int main() {
  ios_base::sync_with_stdio(false);
  string s;
  for (char c1 = 'a'; c1 < 'z' + 1; ++c1) {
    for (char c2 = 'a'; c2 < 'z' + 1; ++c2) {
      s = "";
      s += c1;
      s += c2;
      Pair[c1 - 'a'][c2 - 'a'] = s;
    }
  }
  cin >> n >> m;
  cin.get();
  for (int i = 0; i < n; ++i) {
    cin.read(flag[i], m + 1);
    flag[i][m] = '\0';
  }
  for (int i = 0; i < n; ++i) {
    for (int c1 = 0; c1 < 26; ++c1) {
      for (int c2 = 0; c2 < 26; ++c2) {
        cost[c1][c2][i] = m;
      }
    }
    for (int j = 0; j < m; ++j) {
      int c0 = flag[i][j] - 'a';
      for (int c = 0; c < 26; ++c) {
        if (j % 2 == 0) {
          --cost[c0][c][i];
        } else {
          --cost[c][c0][i];
        }
      }
    }
  }
  for (int c1 = 0; c1 < 26; ++c1) {
    for (int c2 = 0; c2 < 26; ++c2) {
      dp[c1][c2][0] = cost[c1][c2][0];
    }
  }
  for (int i = 1; i < n; ++i) {
    int ptr = 0;
    int cnt = 0;
    for (int c1 = 0; c1 < 26; ++c1) {
      for (int c2 = 0; c2 < 26; ++c2) {
        if (c1 == c2) {
          continue;
        }
        ++cnt;
        buffer[ptr++] = make_pair((dp[c1][c2][i - 1]), (make_pair((c1), (c2))));
        used[c1][c2] = false;
      }
    }
    sort(buffer, buffer + cnt);
    ptr = 0;
    while (cnt) {
      for (int c1 = 0; c1 < 26; ++c1) {
        for (int c2 = 0; c2 < 26; ++c2) {
          pair<int, int> p = buffer[ptr].second;
          if (c1 == c2 || used[c1][c2] || p.first == c1 || p.second == c2) {
            continue;
          }
          dp[c1][c2][i] = dp[p.first][p.second][i - 1] + cost[c1][c2][i];
          parent[c1][c2][i] = p;
          used[c1][c2] = true;
          --cnt;
        }
      }
      ++ptr;
    }
  }
  pair<int, int> p(0, 1);
  for (int c1 = 0; c1 < 26; ++c1) {
    for (int c2 = 0; c2 < 26; ++c2) {
      if (c1 == c2) {
        continue;
      }
      if (dp[c1][c2][n - 1] < dp[p.first][p.second][n - 1]) {
        p = make_pair((c1), (c2));
      }
    }
  }
  cout << dp[p.first][p.second][n - 1] << '\n';
  vector<pair<int, int> > ans;
  ans.reserve(n);
  int row = n - 1;
  while (row != -1) {
    ans.push_back(p);
    p = parent[p.first][p.second][row];
    --row;
  }
  reverse((ans).begin(), (ans).end());
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      flag[i][j] = Pair[ans[i].first][ans[i].second][j % 2];
    }
    cout << flag[i] << '\n';
  }
}
