Problem: One day Maria Ivanovna found a Sasha's piece of paper with a message dedicated to Olya. Maria Ivanovna wants to know what is there in a message, but unfortunately the message is ciphered. Maria Ivanovna knows that her students usually cipher their messages by replacing each letter of an original message by some another letter. Replacement works in such way that same letters are always replaced with some fixed letter, and different letters are always replaced by different letters. 

Maria Ivanovna supposed that the message contains answers to the final exam (since its length is equal to the number of final exam questions). On the other hand she knows that Sasha's answer are not necessary correct. There are K possible answers for each questions. Of course, Maria Ivanovna knows correct answers.

Maria Ivanovna decided to decipher message in such way that the number of Sasha's correct answers is maximum possible. She is very busy now, so your task is to help her.

Input

First line contains length of both strings N (1 ≤ N ≤ 2 000 000) and an integer K — number of possible answers for each of the questions (1 ≤ K ≤ 52). Answers to the questions are denoted as Latin letters abcde...xyzABCDE...XYZ in the order. For example for K = 6, possible answers are abcdef and for K = 30 possible answers are abcde...xyzABCD.

Second line contains a ciphered message string consisting of Latin letters.

Third line contains a correct answers string consisting of Latin letters.

Output

In the first line output maximum possible number of correct Sasha's answers.

In the second line output cipher rule as the string of length K where for each letter from the students' cipher (starting from 'a' as mentioned above) there is specified which answer does it correspond to.

If there are several ways to produce maximum answer, output any of them.

Examples

Input

10 2
aaabbbaaab
bbbbabbbbb


Output

7
ba


Input

10 2
aaaaaaabbb
bbbbaaabbb


Output

6
ab


Input

9 4
dacbdacbd
acbdacbda


Output

9
cdba

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
const long long INF = 4e18L + 1;
const int IINF = 2e9 + 1;
const int limit = 1048576;
using namespace std;
bool bs = false;
struct Dinic {
  struct Din_edge {
    int v;
    long long cap;
    int rev_ind;
  };
  int n, source, sink;
  vector<int> starte, d;
  vector<vector<Din_edge> > nei;
  inline bool bfs() {
    d = vector<int>(n + 1, -1);
    d[source] = 0;
    vector<int> q(1, source);
    for (long long i = (long long)0; i < (long long)q.size(); i++) {
      int v = q[i];
      for (auto w : nei[v])
        if (d[w.v] == -1 && w.cap) {
          q.push_back(w.v);
          d[w.v] = d[v] + 1;
        }
    }
    return d[sink] != -1;
  }
  long long dfs(int v, long long mincap) {
    if (!mincap || v == sink) return mincap;
    long long fp = 0;
    for (long long i = (long long)starte[v]; i < (long long)nei[v].size();
         i++) {
      if (!mincap)
        break;
      else
        starte[v] = i;
      Din_edge& edge = nei[v][i];
      int w = nei[v][i].v;
      if (d[w] == d[v] + 1) {
        long long f = dfs(w, min(mincap, edge.cap));
        mincap -= f;
        fp += f;
        edge.cap -= f;
        nei[edge.v][edge.rev_ind].cap += f;
      }
    }
    return fp;
  }
  Dinic(int n, int source, int sink)
      : n(n), source(source), sink(sink), nei(n + 1) {}
  long long flow() {
    long long maxflow = 0;
    while (bfs()) {
      starte = vector<int>(n + 1, 0);
      maxflow += dfs(source, INF);
    }
    return maxflow;
  }
  void add_edge(int from, int to, long long capacity, long long cap2 = 0) {
    Din_edge e1 = (Din_edge){to, capacity, (int)((nei[to]).size())},
             e2 = (Din_edge){from, cap2, (int)((nei[from]).size())};
    nei[from].push_back(e1);
    nei[to].push_back(e2);
  }
  vector<int> find_source_cc() {
    bfs();
    vector<int> ans;
    for (int i = 0; i <= n; i++)
      if (d[i] != -1) ans.push_back(i);
    return ans;
  }
  void wypisz() {
    for (int i = 1; i <= n; i++) {
      cout << i << ": ";
      for (auto el : nei[i]) cout << "(" << el.v << " " << el.cap << ") ";
      cout << endl;
    }
  }
};
namespace mincost {
const int V = 510, E = 51000, inf = 0x20202020;
int dis[V], q[V * 300], vis[V], fst[V], pre[V], nxt[E], y[E], f[E], c[E], S, T,
    flow, cost, tot, tn;
void init(int s, int t, int Tn) {
  tot = 1;
  tn = Tn;
  for (long long i = (long long)0; i < (long long)tn; i++) fst[i] = 0;
  S = s;
  T = t;
}
void add(int u, int v, int ff, int cc) {
  tot++;
  y[tot] = v;
  nxt[tot] = fst[u];
  f[tot] = ff;
  c[tot] = cc;
  fst[u] = tot;
  tot++;
  y[tot] = u;
  nxt[tot] = fst[v];
  f[tot] = 0;
  c[tot] = -cc;
  fst[v] = tot;
}
bool spfa() {
  for (long long i = (long long)0; i < (long long)tn; i++)
    dis[i] = inf, vis[i] = 0, pre[i] = 0;
  dis[S] = 0;
  q[0] = S;
  vis[S] = 1;
  int t = 1;
  for (long long i = (long long)0; i < (long long)t; i++) {
    int u = q[i];
    for (int j = fst[u]; j; j = nxt[j]) {
      int v = y[j];
      if (f[j] && dis[v] > dis[u] + c[j]) {
        dis[v] = dis[u] + c[j];
        pre[v] = j;
        if (!vis[v]) vis[v] = 1, q[t++] = v;
      }
    }
    vis[u] = 0;
  }
  return dis[T] != inf;
}
void augment() {
  int p = T, _f = inf;
  while (pre[p]) _f = min(_f, f[pre[p]]), p = y[pre[p] ^ 1];
  flow += _f;
  cost += _f * dis[T];
  p = T;
  while (pre[p]) f[pre[p]] -= _f, f[pre[p] ^ 1] += _f, p = y[pre[p] ^ 1];
}
void solve() {
  flow = 0, cost = 0;
  while (spfa()) augment();
}
}  // namespace mincost
using namespace mincost;
int ile[60][60];
int rozw[60];
int main() {
  int a, b;
  string s1, s2;
  cin >> a >> b >> s1 >> s2;
  for (auto& el : s1) {
    if (el > 'Z')
      el = el - 'a' + 1;
    else
      el = el - 'A' + 27;
  }
  for (auto& el : s2) {
    if (el > 'Z')
      el = el - 'a' + 1;
    else
      el = el - 'A' + 27;
  }
  for (int i = 0; i < a; i++) ile[s1[i]][s2[i]]++;
  init(1, 2 * b + 2, 2 * b + 3);
  for (int i = 2; i <= b + 1; i++) add(1, i, 1, 0);
  for (int i = b + 2; i <= 2 * b + 1; i++) add(i, 2 * b + 2, 1, 0);
  for (int i = 2; i <= b + 1; i++)
    for (int j = b + 2; j <= 2 * b + 1; j++)
      add(i, j, 1, -ile[i - 1][j - b - 1]);
  solve();
  cout << -cost << endl;
  for (int i = 0; i < tot; i += 2) {
    if (y[i + 1] > 1 && y[i + 1] <= b + 1 && y[i] > b + 1 && y[i] < 2 * b + 2 &&
        f[i] == 0)
      rozw[y[i + 1] - 1] = y[i] - 1 - b;
  }
  for (int i = 1; i <= b; i++) {
    char c;
    if (rozw[i] < 27) {
      c = 'a' - 1 + rozw[i];
    } else {
      c = 'A' - 27 + rozw[i];
    }
    cout << c;
  }
  return 0;
}