#include <bits/stdc++.h>
using namespace std;
class Solution {
 public:
  vector<string> solve(vector<string>& M) {
    int n = M.size();
    int m = M[0].size();
    const int A = 26;
    const int INF = 1 << 28;
    if (m == 1) {
      vector<vector<int>> dp(n + 1, vector<int>(A, INF));
      for (int i = 0; i < A; ++i) {
        dp[0][i] = 0;
      }
      for (int i = 0; i < n; ++i) {
        int ch = M[i][0] - 'a';
        for (int j = 0; j < A; ++j) {
          for (int k = 0; k < A; ++k) {
            if (j == k) {
              continue;
            }
            dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + (k != ch));
          }
        }
      }
      vector<string> res(n);
      pair<int, int> best{1 << 28, 0};
      for (int i = 0; i < A; ++i) {
        best = min(best, make_pair(dp[n][i], i));
      }
      int ch = best.second;
      int cost = best.first;
      for (int i = n; i > 0; --i) {
        res[i - 1] += (char)('a' + ch);
        if (M[i - 1][0] != res[i - 1][0]) {
          --cost;
        }
        int nch = -1;
        for (int j = 0; j < A; ++j) {
          if (j == ch) {
            continue;
          }
          if (dp[i - 1][j] == cost) {
            nch = j;
            break;
          }
        }
        assert(nch >= 0 && nch != ch);
        ch = nch;
      }
      return res;
    } else {
      vector<vector<vector<int>>> dp(
          n + 1, vector<vector<int>>(A, vector<int>(A, INF)));
      for (int j = 0; j < A; ++j) {
        for (int k = 0; k < A; ++k) {
          if (j != k) {
            dp[0][j][k] = 0;
          }
        }
      }
      vector<vector<int>> cnts(2, vector<int>(A, 0));
      for (int i = 0; i < n; ++i) {
        for (auto& V : cnts) {
          fill(V.begin(), V.end(), 0);
        }
        for (int j = 0; j < m; ++j) {
          cnts[j & 1][M[i][j] - 'a'] += 1;
        }
        for (int j = 0; j < A; ++j) {
          for (int k = 0; k < A; ++k) {
            if (dp[i][j][k] >= INF) {
              continue;
            }
            for (int nj = 0; nj < A; ++nj) {
              if (nj == j) {
                continue;
              }
              for (int nk = 0; nk < A; ++nk) {
                if (nj == nk || nk == k) {
                  continue;
                }
                int cost = ((m + 1) >> 1) - cnts[0][nj];
                cost += (m >> 1) - cnts[1][nk];
                dp[i + 1][nj][nk] = min(dp[i + 1][nj][nk], dp[i][j][k] + cost);
              }
            }
          }
        }
      }
      pair<int, pair<int, int>> best{INF, make_pair(0, 0)};
      for (int i = 0; i < A; ++i) {
        for (int j = 0; j < A; ++j) {
          best = min(best, make_pair(dp[n][i][j], make_pair(i, j)));
        }
      }
      int a = best.second.first, b = best.second.second;
      int cost = best.first;
      vector<string> res(n, string(m, ' '));
      for (int i = n; i > 0; --i) {
        for (int j = 0; j < m; ++j) {
          res[i - 1][j] = (char)('a' + ((j & 1) ? b : a));
        }
        cost -= m;
        for (int j = 0; j < m; ++j) {
          if (j & 1) {
            if (M[i - 1][j] - 'a' == b) {
              ++cost;
            }
          } else {
            if (M[i - 1][j] - 'a' == a) {
              ++cost;
            }
          }
        }
        bool done = false;
        for (int na = 0; na < A && !done; ++na) {
          if (na == a) {
            continue;
          }
          for (int nb = 0; nb < A && !done; ++nb) {
            if (nb == b) {
              continue;
            }
            if (cost == dp[i - 1][na][nb]) {
              a = na;
              b = nb;
              done = true;
            }
          }
        }
        assert(done);
      }
      return res;
    }
    assert(0);
    return {};
  }
};
int main(int argc, char** argv) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  Solution sol;
  int n, m;
  cin >> n >> m;
  vector<string> M(n);
  for (int i = 0; i < n; ++i) {
    cin >> M[i];
  }
  auto res = sol.solve(M);
  int diffs = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      diffs += M[i][j] != res[i][j];
    }
  }
  cout << diffs << '\n';
  for (auto& s : res) {
    cout << s << '\n';
  }
  return 0;
}
