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
import java.util.*;
import java.io.*;
public class Deciphering
{
	public static final int INFINITY = 500000000;
	
	public static ArrayList<Edge>[] edges;
	public static int source;
	public static int sink;
	public static Edge[] prev;
	public static int[] pi;
	
	public static void main(String[] args) throws Exception
	{
		FastScanner in = new FastScanner(System.in);
		
		int n = in.nextInt();
		int k = in.nextInt();
		
		String ciphered = in.next();
		String correct = in.next();
		
		int[][] freq = new int[k][k];
		for(int x = 0; x < ciphered.length(); x++)
		{
			freq[convert(ciphered.charAt(x))][convert(correct.charAt(x))]++;
		}
		
		edges = new ArrayList[2 * k + 2];
		for(int y = 0; y < edges.length; y++)
		{
			edges[y] = new ArrayList<Edge>();
		}
		
		source = 2 * k;
		sink = source + 1;
		
		for(int z = 0; z < freq.length; z++)
		{
			add(source, z, 1, 0);
			add(k + z, sink, 1, 0);
			
			for(int a = 0; a < freq[0].length; a++)
			{
				add(z, k + a, 1, -freq[z][a]);
			}
		}
		
		System.out.println(-minCostMaxFlow());
		
		StringBuilder sb = new StringBuilder();
		for(int b = 0; b < k; b++)
		{
			for(Edge e : edges[b])
			{
				if(e.end != source && e.capacity == 0)
				{
					sb.append(convert(e.end - k));
					break;
				}
			}
		}
		
		System.out.println(sb);
	}
	
	public static int convert(char c)
	{
		if(Character.isLowerCase(c))
		{
			return c - 'a';
		}
		else
		{
			return 26 + c - 'A';
		}
	}
	
	public static char convert(int i)
	{
		if(i < 26)
		{
			return (char)(i + 'a');
		}
		else
		{
			return (char)(i - 26 + 'A');
		}
	}
	
	public static void add(int a, int b, int cap, int c)
	{
		Edge e1 = new Edge(a, b, cap, c);
		Edge e2 = new Edge(b, a, 0, -c);
		e1.opposite = e2;
		e2.opposite = e1;
		edges[a].add(e1);
		edges[b].add(e2);
	}
	
	public static int minCostMaxFlow()
	{
		int result = 0;
		
		pi = new int[edges.length];
		
		getPotential();
		
		while(findPath())
		{
			int flow = getPathCapacity(sink);
			result += update(sink, flow);
		}
		
		return result;
	}
	
	public static void getPotential()
	{
		int[] dist = new int[edges.length];
		Arrays.fill(dist, INFINITY);
		dist[source] = 0;
		
		for(int i = 1; i < dist.length; i++)
		{
			for(int j = 0; j < edges.length; j++)
			{
				for(Edge e : edges[j])
				{
					if(e.capacity > 0 && dist[e.start] + e.cost < dist[e.end])
					{
						dist[e.end] = dist[e.start] + e.cost;
					}
				}
			}
		}
		
		for(int j = 0; j < pi.length; j++)
		{
			pi[j] = dist[j];
		}
	}
	
	public static int reducedCost(Edge e)
	{
		if(e.capacity > 0)
		{
			return e.cost + pi[e.start] - pi[e.end];
		}
		else
		{
			return 0;
		}
	}
	
	public static boolean findPath()
	{
		int[] dist = new int[edges.length];
		Arrays.fill(dist, INFINITY);
		dist[source] = 0;
		
		prev = new Edge[edges.length];
		Arrays.fill(prev, null);
		
		PriorityQueue<Node> unused = new PriorityQueue<Node>();
		unused.add(new Node(source, 0));
		
		while(unused.size() > 0)
		{
			Node node = unused.poll();
			
			if(node.dist == dist[node.index])
			{
				for(Edge e : edges[node.index])
				{
					if(e.capacity > 0)
					{
						int newDist = dist[node.index] + reducedCost(e);
						if(newDist < dist[e.end])
						{
							dist[e.end] = newDist;
							prev[e.end] = e;
							
							unused.add(new Node(e.end, newDist));
						}
					}
				}
			}
		}
		
		for(int j = 0; j < pi.length; j++)
		{
			pi[j] = dist[j];
		}
		
		return (dist[sink] < INFINITY);
	}
	
	public static int getPathCapacity(int end)
	{
		int node = end;
		int min = Integer.MAX_VALUE;
		
		while(prev[node] != null)
		{
			min = Math.min(min, prev[node].capacity);
			node = prev[node].start;
			
			if(node == end)
			{
				break;
			}
		}
		
		return min;
	}
	
	public static int update(int end, int flow)
	{
		int node = end;
		int current = 0;
		
		while(prev[node] != null)
		{
			prev[node].capacity -= flow;
			prev[node].opposite.capacity += flow;
			current += flow * prev[node].cost;
			node = prev[node].start;
			
			if(node == end)
			{
				break;
			}
		}
		
		return current;
	}
	
	static class Edge
	{
		int start;
		int end;
		int capacity;
		int cost;
		Edge opposite;
		
		public Edge(int s, int e, int cap, int c)
		{
			start = s;
			end = e;
			capacity = cap;
			cost = c;
		}
	}
	
	static class Node implements Comparable<Node>
	{
		int index;
		int dist;
		
		public Node(int i, int d)
		{
			index = i;
			dist = d;
		}
		
		public int compareTo(Node o)
		{
			if(dist != o.dist)
			{
				return dist - o.dist;
			}
			else
			{
				return index - o.index;
			}
		}
	}
	
	static class FastScanner
	{
		BufferedReader br;
		StringTokenizer st;
		
		public FastScanner(InputStream input)
		{
			br = new BufferedReader(new InputStreamReader(input));
			st = new StringTokenizer("");
		}
		
		public String next() throws IOException
		{
			if(st.hasMoreTokens())
			{
				return st.nextToken();
			}
			else
			{
				st = new StringTokenizer(br.readLine());
				return next();
			}
		}
		
		public int nextInt() throws IOException
		{
			return Integer.parseInt(next());
		}
	}
}
