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;
struct Node {
  int node, capacity, opposite_index, cost;
  bool LevelSetVisit;
  Node(int n, int c, int co, int oi, bool lsv) {
    node = n;
    capacity = c;
    cost = co;
    opposite_index = oi;
    LevelSetVisit = lsv;
  }
};
vector<Node> Graph[200 + 0];
int cost[200 + 0], parent[200 + 0][2];
void clearGraph(int N) {
  int i;
  for (i = 0; i < 0 + N; i++) {
    while (Graph[i].size() > 0) {
      Graph[i].pop_back();
    }
  }
}
int ShortestPath(int source, int sink, int n) {
  int M[200 + 0];
  int i, j;
  deque<int> q;
  for (i = 0; i < 0 + n; i++) {
    cost[i] = 1000000000;
    M[i] = 2;
  }
  cost[source] = 0;
  M[source] = 1;
  q.push_back(source);
  while (!q.empty()) {
    int n = q.front();
    q.pop_front();
    M[n] = 0;
    for (i = 0; i < Graph[n].size(); i++) {
      int child = Graph[n][i].node;
      if (Graph[n][i].capacity > 0 &&
          cost[child] > cost[n] + Graph[n][i].cost) {
        cost[child] = cost[n] + Graph[n][i].cost;
        parent[child][0] = n;
        parent[child][1] = i;
        if (M[child] == 2) {
          M[child] = 1;
          q.push_back(child);
        } else if (M[child] == 0) {
          q.push_front(child);
          M[child] = 1;
        }
      }
    }
  }
  return cost[sink];
}
int MinCostFlow(int source, int sink, int n, int demandFlow) {
  int flow = 0;
  int Cost = 0;
  int cost = 0;
  do {
    cost = ShortestPath(source, sink, n);
    int remaining = demandFlow - flow;
    if (cost < 1000000000) {
      int node = sink;
      int f = remaining;
      while (node != source) {
        int ind = parent[node][1];
        int p = parent[node][0];
        int possibleFlow = Graph[p][ind].capacity;
        if (possibleFlow < f) {
          f = possibleFlow;
        }
        node = p;
      }
      Cost = Cost + cost * f;
      flow = flow + f;
      node = sink;
      while (node != source) {
        int p = parent[node][0];
        int pind = parent[node][1];
        int ind = Graph[p][pind].opposite_index;
        Graph[p][pind].capacity -= f;
        Graph[node][ind].capacity += f;
        node = p;
      }
    }
  } while (flow < demandFlow && cost < 1000000000);
  if (flow == demandFlow)
    return Cost;
  else
    return -1;
}
char sasha[2000005], correct[2000005];
char num(int a) {
  if (a > 26)
    return (a - 27) + 'A';
  else
    return (a - 1) + 'a';
}
int main() {
  int N, K;
  int i, j, k;
  scanf("%d %d ", &N, &K);
  int match[53][53] = {0};
  int sa[53] = {0};
  int cr[53] = {0};
  for (i = 1; i <= K; i++) {
    Graph[i].push_back(Node(0, 0, 0, Graph[0].size(), false));
    Graph[0].push_back(Node(i, 1, 0, Graph[i].size() - 1, false));
    Graph[K + i].push_back(
        Node(K * 2 + 1, 1, 0, Graph[K * 2 + 1].size(), false));
    Graph[K * 2 + 1].push_back(
        Node(K + i, 0, 0, Graph[K + i].size() - 1, false));
  }
  gets(sasha);
  gets(correct);
  for (i = 0; i < N; i++) {
    if (sasha[i] >= 'a') {
      j = 1 + (sasha[i] - 'a');
    } else {
      j = 27 + (sasha[i] - 'A');
    }
    if (correct[i] >= 'a') {
      k = 1 + (correct[i] - 'a');
    } else {
      k = 27 + (correct[i] - 'A');
    }
    sa[j]++;
    cr[k]++;
    match[j][k]++;
  }
  for (i = 1; i <= K; i++) {
    for (j = 1; j <= K; j++) {
      int c = sa[i] + cr[j] - match[i][j] * 2;
      Graph[i].push_back(Node(j + K, 1, c, Graph[j + K].size(), false));
      Graph[j + K].push_back(Node(i, 0, -c, Graph[i].size() - 1, false));
    }
  }
  int flow = MinCostFlow(0, K * 2 + 1, K * 2 + 2, K);
  flow = N - (flow / 2);
  printf("%d\n", flow);
  for (i = 1; i <= K; i++) {
    for (j = 0; j < Graph[i].size(); j++) {
      if (Graph[i][j].node == 0 || Graph[i][j].capacity == 1) continue;
      printf("%c", num(Graph[i][j].node - K));
      break;
    }
  }
  return 0;
}