func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k;   string s;   int main() {     cin.tie(0);     std::ios::sync_with_stdio(false);     cin >> n >> k;     cin >> s;     if (k == 2) {       string s1 =   , s2 =   ;       for (int i = 0; i < s.size(); i++)         if (i & 1)           s1 +=  A , s2 +=  B ;         else           s1 +=  B , s2 +=  A ;       int x = 0, y = 0;       for (int i = 0; i < s.size(); i++)         x += (s[i] == s1[i] ? 1 : 0), y += (s[i] == s2[i] ? 1 : 0);       if (x > y)         cout << s.size() - x << endl << s1 << endl;       else         cout << s.size() - y << endl << s2 << endl;       return 0;     }     string h;     int z = 1;     map<int, char> mop;     map<char, int> mops;     for (char c =  A ; c <=  Z ; c++) {       mop[z] = c, mops[c] = z, z++;       if (z > k) break;     }     string t = s;     int ans = 0;     for (int i = 0; i < s.size() - 1; i++) {       if (s[i] == s[i + 1]) {         h = s[i], h += s[i + 1];         int f = i + 1;         for (int j = i + 2; j < s.size(); j++) {           if (s[j] != s[i]) break;           f++;           h += s[j];         }         char prev = s[i - 1], next = h[1];         if (h.size() % 2 == 0)           for (int j = 0; j < h.size(); j += 2) {             for (__typeof((mops).begin()) it = (mops).begin(); it != (mops).end();                  it++)               if (it->first != prev && it->first != next) {                 h[j] = it->first;                 prev = h[j + 1], next = h[j + 3];                 ans++;                 break;               }           }         else {           prev = h[0], next = h[2];           for (int j = 1; j < h.size(); j += 2) {             for (__typeof((mops).begin()) it = (mops).begin(); it != (mops).end();                  it++)               if (it->first != prev && it->first != next) {                 h[j] = it->first;                 prev = h[j + 1];                 next = h[j + 3];                 ans++;                 break;               }           }         }         int n = 0;         for (int j = i; j < f; j++) s[j] = h[n++];         i = f - 1;       }     }     cout << ans << endl;     cout << s << endl;     return 0;   }   