given two strings of lowercase letters, a and b , print the longest string x of lowercase letters such that there is a permutation of x that is subsequence of a and there is a permutation of x that is a subsequence of b
input file contain several lines of inputs. Consecutive two line make a set of input. that mean in the input file line1 and 2 is a set of input
the first line of a pair contain a and second contain b.
Each string is on separate line and consists of the most 1000 lowercase letters
for each set of input, output a line containing x.
if several x satisfy the criteria , choose the first one in alphabetical order