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>
int cost[305][305];
int n, opt_mean;
int lx[305], ly[305], x_to_y[305], y_to_x[305], slack[305], slackx[305],
    prev[305];
bool Left_Pair[305], Right_Pair[305];
void update() {
  int x, y, delta = INT_MAX;
  for (y = 0; y < n; y++) {
    if (!Right_Pair[y]) {
      delta = std::min(delta, slack[y]);
    }
  }
  for (x = 0; x < n; x++) {
    if (Left_Pair[x]) {
      lx[x] -= delta;
    }
  }
  for (y = 0; y < n; y++) {
    if (Right_Pair[y]) {
      ly[y] += delta;
    } else {
      slack[y] -= delta;
    }
  }
}
void addition(int x, int prevx) {
  Left_Pair[x] = true;
  prev[x] = prevx;
  for (int y = 0; y < n; y++) {
    if (lx[x] + ly[y] - cost[x][y] < slack[y]) {
      slack[y] = lx[x] + ly[y] - cost[x][y];
      slackx[y] = x;
    }
  }
}
void finding_path() {
  if (opt_mean == n) {
    return;
  }
  int x, y, root = 0;
  int q[305], wr = 0, rd = 0;
  memset(Left_Pair, false, sizeof(Left_Pair));
  memset(Right_Pair, false, sizeof(Right_Pair));
  memset(prev, -1, sizeof(prev));
  for (x = 0; x < n; x++) {
    if (x_to_y[x] == -1) {
      q[wr++] = root = x;
      prev[x] = -2;
      Left_Pair[x] = true;
      break;
    }
  }
  for (y = 0; y < n; y++) {
    slack[y] = lx[root] + ly[y] - cost[root][y];
    slackx[y] = root;
  }
  while (true) {
    while (rd < wr) {
      x = q[rd++];
      for (y = 0; y < n; y++)
        if (cost[x][y] == lx[x] + ly[y] && !Right_Pair[y]) {
          if (y_to_x[y] == -1) {
            break;
          }
          Right_Pair[y] = true;
          q[wr++] = y_to_x[y];
          addition(y_to_x[y], x);
        }
      if (y < n) {
        break;
      }
    }
    if (y < n) {
      break;
    }
    update();
    wr = rd = 0;
    for (y = 0; y < n; y++)
      if (!Right_Pair[y] && slack[y] == 0) {
        if (y_to_x[y] == -1) {
          x = slackx[y];
          break;
        } else {
          Right_Pair[y] = true;
          if (!Left_Pair[y_to_x[y]]) {
            q[wr++] = y_to_x[y];
            addition(y_to_x[y], slackx[y]);
          }
        }
      }
    if (y < n) break;
  }
  if (y < n) {
    opt_mean++;
    for (int cx = x, cy = y, ty; cx != -2; cx = prev[cx], cy = ty) {
      ty = x_to_y[cx];
      y_to_x[cy] = cx;
      x_to_y[cx] = cy;
    }
    finding_path();
  }
}
int main() {
  int k, len;
  std::cin >> len >> k;
  n = k;
  std::map<char, int> alph = {
      {'a', 0},  {'b', 1},  {'c', 2},  {'d', 3},  {'e', 4},  {'f', 5},
      {'g', 6},  {'h', 7},  {'i', 8},  {'j', 9},  {'k', 10}, {'l', 11},
      {'m', 12}, {'n', 13}, {'o', 14}, {'p', 15}, {'q', 16}, {'r', 17},
      {'s', 18}, {'t', 19}, {'u', 20}, {'v', 21}, {'w', 22}, {'x', 23},
      {'y', 24}, {'z', 25}, {'A', 26}, {'B', 27}, {'C', 28}, {'D', 29},
      {'E', 30}, {'F', 31}, {'G', 32}, {'H', 33}, {'I', 34}, {'J', 35},
      {'K', 36}, {'L', 37}, {'M', 38}, {'N', 39}, {'O', 40}, {'P', 41},
      {'Q', 42}, {'R', 43}, {'S', 44}, {'T', 45}, {'U', 46}, {'V', 47},
      {'W', 48}, {'X', 49}, {'Y', 50}, {'Z', 51}};
  std::vector<char> alphabet = {
      'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
      'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
      'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
      'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
  std::string first, second;
  std::cin >> first;
  std::cin >> second;
  for (int i = 0; i < len; ++i) {
    cost[alph[first[i]]][alph[second[i]]] += 1;
  }
  memset(lx, 0, sizeof(lx));
  memset(ly, 0, sizeof(ly));
  for (int x = 0; x < n; x++)
    for (int y = 0; y < n; y++) lx[x] = std::max(lx[x], cost[x][y]);
  std::vector<std::pair<long long, long long>> ans;
  int ret = 0;
  opt_mean = 0;
  memset(x_to_y, -1, sizeof(x_to_y));
  memset(y_to_x, -1, sizeof(y_to_x));
  finding_path();
  ans.push_back(std::make_pair(0, 0));
  for (long long x = 0; x < n; x++) {
    ans.push_back(std::make_pair(x_to_y[x] + 1, x + 1));
    ret += cost[x][x_to_y[x]];
  }
  ans[0].first = ret;
  std::cout << ans[0].first << std::endl;
  for (long long i = 1; i < ans.size(); ++i) {
    std::cout << alphabet[ans[i].first - 1];
  }
}