Byteman is porting his favorite text editor to a new phone called Byephone (a name coined from the words byte and phone).
One feature of this editor compares two documents line by line. The comparison is based on an algorithm that computes the Longest Common Subsequence (LCS) of two strings.
Byteman soon realizes that the phone does not have nearly enough memory to run the algorithm he uses, so he asks for your help.
Using only 3MB of memory, write a program that finds the longest common subsequence of the two given strings.
The first line contains two integers n1 and n2 (1≤n1,n2≤10000), the lengths of the two strings.
The second and third lines contain the two strings, of lengths n1 and n2 respectively. Both strings consist only of lowercase English letters.
Print two lines.
On the first line, print the length K of the longest common subsequence of the two strings.
On the second line, print a longest common subsequence of length K. If there are several longest common subsequences of length K, print the lexicographically smallest one.
If there is no common subsequence, print 0 on the first line and leave the second line empty.