Problem:

 

Given a sequence X={X1, X2,...,Xm}, another sequence  Z={Z1, Z2,...Zk} is a subsequence of X if there exists a strictly increasing sequence {i1,i2,..,ik} of indices of X such that for all j=1,2,...,k, we have Xij = Zj. For example, Z= {B, C, D, B} is a subsequence of X={ A, B, C, B, D, A, B} with corresponding index sequence {2, 3, 5, 7}.

 

Given two sequences X and Y, we say that a sequence Z is a common subsequence of X and Y if Z is a subsequence of both X and Y. For example, if X={ A,B,C,B,D,A,B} and Y={B,D, C,A,B,A}, the sequence {B,C,A} is a common subsequence of both X and Y. However, Z is not the longest common subsequence of X and Y; the longest common subsequence of them is {B, C, B, A} with the length 4, since there is no common subsequence of length 5 or greater.

 

Now, you are given two sequences X and Y and wished to find maximum-length common subsequence(s) of X and Y.

 

Input:

 

The input consists of several test cases. Each test case consists of two lines: each line contains a sequence. The length of each sequence is at least one and does not exceed 100.

 

Output:

 

For each test case, print the length of the longest common sequence in the first line. This is followed by line(s),each line contains a longest common sequence, in alphabetical order. Print a blank line between each consecutive test case.

 

Sample Input:

 

ABCDE

ABDCE

 

Sample Output:

 

4

ABCE

ABDE