Common permutation#2040

Common permutation

1 second
128 megabytes
Very easy

Given two strings and consisting of lowercase letters, find the longest string that can be obtained as a subsequence of a permutation of and as a subsequence of a permutation of .

Input

The input consists of several test cases. Each test case contains two strings: the first line contains , and the second line contains . Each string is on a separate line and consists of at most lowercase letters.

Output

For each test case, print the string on a separate line. If there are multiple possible , print the lexicographically smallest one.

Examples

Example 1

Loading
Loading