func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   istream& operator>>(istream& is, vector<T>& v) {     for (auto& it : v) is >> it;     return is;   }   template <class L, class R>   ostream& operator<<(ostream& os, pair<L, R> P) {     return os <<  (  << P.first <<  ,  << P.second <<  ) ;   }   template <class T>   ostream& operator<<(ostream& os, vector<T> V) {     os <<  [  ;     for (auto v : V) os << v <<    ;     return os <<  ] ;   }   template <class T>   ostream& operator<<(ostream& os, set<T> second) {     os <<  {  ;     for (auto s : second) os << s <<    ;     return os <<  } ;   }   template <typename Arg1>   void __f(const char* name, Arg1&& arg1) {     cout << name <<   :   << arg1 <<   n ;   }   template <typename Arg1, typename... Args>   void __f(const char* names, Arg1&& arg1, Args&&... args) {     const char* comma = strchr(names + 1,  , );     cout.write(names, comma - names) <<   :   << arg1 <<   | ;     __f(comma + 1, args...);   }   vector<int> hungarianMethod(vector<vector<int>> W) {     int n = ((int)(W).size()), m = ((int)(W[0]).size()), PHI = -1, NOL = -2,         INF = 1e9;     vector<vector<bool>> x(n, vector<bool>(m));     vector<bool> ss(n), st(m);     int f = 0;     for (int i = 0; i < n; i++) {       f = max(f, (*max_element(W[i].begin(), W[i].end())));     }     vector<int> u(n, f), v(m), p(m, INF), ls(n, PHI), lt(m, NOL), a(n, -1);     while (true) {       f = -1;       for (int i = 0; i < n and f == -1; i++) {         if (ls[i] != NOL and ss[i] == 0) {           f = i;         }       }       if (f != -1) {         ss[f] = true;         for (int j = 0; j < m; j++) {           if (x[f][j] == 0 and u[f] + v[j] - W[f][j] < p[j]) {             lt[j] = f;             p[j] = u[f] + v[j] - W[f][j];           }         }       } else {         for (int i = 0; i < m and f == -1; i++) {           if (lt[i] != NOL and st[i] == 0 and p[i] == 0) {             f = i;           }         }         if (f == -1) {           int d1 = INF, d2 = INF, d;           for (int i : u) {             d1 = min(d1, (i));           }           for (int i : p) {             if (i > 0) {               d2 = min(d2, (i));             }           }           d = min(d1, d2);           for (int i = 0; i < n; i++) {             if (ls[i] != NOL) {               u[i] -= d;             }           }           for (int i = 0; i < m; i++) {             if (p[i] == 0) {               v[i] += d;             }             if (p[i] > 0 and lt[i] != NOL) {               p[i] -= d;             }           }           if (d2 >= d1) {             break;           }         } else {           st[f] = true;           int s = -1;           for (int i = 0; i < n and s == -1; i++) {             if (x[i][f]) {               s = i;             }           }           if (s == -1) {             for (int l, r;; f = r) {               r = f;               l = lt[r];               if (r >= 0 and l >= 0) {                 x[l][r] = !x[l][r];               } else {                 break;               }               r = ls[l];               if (r >= 0 and l >= 0) {                 x[l][r] = !x[l][r];               } else {                 break;               }             }             fill(p.begin(), p.end(), INF);             fill(lt.begin(), lt.end(), NOL);             fill(ls.begin(), ls.end(), NOL);             fill(ss.begin(), ss.end(), false);             fill(st.begin(), st.end(), false);             for (int i = 0; i < n; i++) {               bool ex = true;               for (int j = 0; j < m and ex; j++) {                 ex = !x[i][j];               }               if (ex) {                 ls[i] = PHI;               }             }           } else {             ls[s] = f;           }         }       }     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (x[i][j]) {           a[j] = i;         }       }     }     return a;   }   void solve() {     map<char, int> ind;     map<int, char> revInd;     for (char ch =  a ; ch <=  z ; ++ch) {       ind[ch] = ch -  a ;       revInd[ind[ch]] = ch;     }     for (char ch =  A ; ch <=  Z ; ++ch) {       ind[ch] = (ch -  A ) + 26;       revInd[ind[ch]] = ch;     }     int n, k;     cin >> n >> k;     string a, b;     cin >> a >> b;     vector<vector<int>> W(k, vector<int>(k, 1));     for (int i = 0; i < n; ++i) {       W[ind[a[i]]][ind[b[i]]]++;     }     vector<int> matching = hungarianMethod(W);     int ans = 0;     string res(k,  $ );     for (int i = 0; i < k; ++i) {       ans += W[matching[i]][i] - 1;       res[matching[i]] = revInd[i];     }     cout << ans <<   n  << res <<   n ;   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int T = 1;     while (T--) {       solve();     }     return 0;   }   