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>
using namespace std;
const long long inf = 2147383647;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;
struct debugger {
  template <typename T>
  debugger& operator,(const T& v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
inline long long gcd(long long a, long long b) {
  a = ((a) < 0 ? -(a) : (a));
  b = ((b) < 0 ? -(b) : (b));
  while (b) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
int ext_gcd(int a, int b, int& x, int& y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  int x1, y1;
  int d = ext_gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
inline long long modInv(int a, int m) {
  int x, y;
  ext_gcd(a, m, x, y);
  if (x < 0) x += m;
  return x;
}
inline long long power(long long a, long long p) {
  long long res = 1, x = a;
  while (p) {
    if (p & 1) res = (res * x);
    x = (x * x);
    p >>= 1;
  }
  return res;
}
inline long long bigmod(long long a, long long p, long long m) {
  long long res = 1, x = a % m;
  while (p) {
    if (p & 1) res = (res * x) % m;
    x = (x * x) % m;
    p >>= 1;
  }
  return res;
}
struct node {
  int x, y, next, cap, cost;
};
struct FLOW {
  int source, sink;
  int head[300];
  void clear() {
    e = 0;
    memset(head, -1, sizeof(head));
  }
  node edge[1000000];
  int e;
  void addEdge(int u, int v, int cap, int cost) {
    edge[e].x = u;
    edge[e].y = v;
    edge[e].cap = cap;
    edge[e].cost = cost;
    edge[e].next = head[u];
    head[u] = e;
    e++;
    edge[e].x = v;
    edge[e].y = u;
    edge[e].cap = 0;
    edge[e].cost = -cost;
    edge[e].next = head[v];
    head[v] = e;
    e++;
  }
  int vis[300], q[300], now[300];
  int inq[300], par[300], record[300];
  int minCostFlow(int limit) {
    int res = 0, i, j, k, fl = 0;
    while (1) {
      for (i = 0; i <= limit; i++) vis[i] = -inf;
      vis[source] = 0;
      deque<int> dq;
      dq.push_back(source);
      while (!dq.empty()) {
        int s = dq.front();
        dq.pop_front();
        inq[s] = 0;
        for (i = head[s]; i != -1; i = edge[i].next) {
          int t = edge[i].y;
          if (edge[i].cap) {
            if (vis[s] + edge[i].cost > vis[t]) {
              vis[t] = vis[s] + edge[i].cost;
              par[t] = s;
              record[t] = i;
              if (inq[t] == 0) {
                inq[t] = 1;
                if (dq.empty() == false && vis[dq.front()] < vis[t])
                  dq.push_front(t);
                else
                  dq.push_back(t);
              }
            }
          }
        }
      }
      if (vis[sink] < 0) break;
      fl++;
      res += vis[sink];
      for (i = sink; i != source; i = par[i]) {
        int t = record[i];
        edge[t].cap--;
        edge[t ^ 1].cap++;
      }
    }
    return res;
  }
} graph;
char buf1[2000010], buf2[2000010];
int cost[100][100];
int track[100][100];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  scanf("%s %s", buf1, buf2);
  for (int i = (0); i <= (n - 1); ++i) {
    if (buf1[i] >= 'a' && buf1[i] <= 'z')
      buf1[i] = buf1[i] - 'a' + 1;
    else if (buf1[i] >= 'A' && buf1[i] <= 'Z')
      buf1[i] = buf1[i] - 'A' + 27;
  }
  for (int i = (0); i <= (n - 1); ++i) {
    if (buf2[i] >= 'a' && buf2[i] <= 'z')
      buf2[i] = buf2[i] - 'a' + 1;
    else if (buf2[i] >= 'A' && buf2[i] <= 'Z')
      buf2[i] = buf2[i] - 'A' + 27;
  }
  for (int i = (0); i <= (n - 1); ++i) {
    int u = buf1[i];
    int v = buf2[i];
    cost[u][v]++;
  }
  graph.clear();
  graph.source = 0;
  graph.sink = 105;
  for (int i = (1); i <= (52); ++i) {
    graph.addEdge(0, i, 1, 0);
    graph.addEdge(i + 52, graph.sink, 1, 0);
  }
  for (int i = (1); i <= (k); ++i) {
    for (int j = (1); j <= (k); ++j) {
      track[i][j] = graph.e;
      graph.addEdge(i, 52 + j, 1, cost[i][j]);
    }
  }
  int res = graph.minCostFlow(105);
  printf("%d\n", res);
  for (int i = (1); i <= (k); ++i) {
    for (int j = (1); j <= (k); ++j) {
      int e = track[i][j];
      if (graph.edge[e].cap == 0) {
        int x = j;
        if (x <= 26)
          x = x - 1 + 'a';
        else
          x = x - 26 - 1 + 'A';
        printf("%c", x);
        break;
      }
    }
  }
  puts("");
  return 0;
}