B. Paulo's Plan
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
tis not a valorous contest, unless thee has't a string problem
— Mateo, Advices to Ahmad

Paulo is always trying to sabotage the Juan group, this time he is trying to sabotage Mateo's precious strings.

Mateo has a small string $$$T$$$ consisting of distinct characters, and a big string $$$S$$$ consisting of the same characters as $$$T$$$.

Let's say that a pair of strings $$$(A, B)$$$ is good if we can duplicate the characters of $$$B$$$ a finite number of times without changing their order so that $$$A = B$$$, e.g, $$$(aabb, ab), (aabbbbbccc, abc)$$$ are good pairs, $$$(abcccc, ab), (acccb, abc)$$$ are not.

Let's define $$$cost(A, B)$$$ as the minimum number of swaps of adjacent characters in $$$A$$$ so that $$$(A, B)$$$ becomes a good pair.

Paulo knows Mateo will do anything to make the pair a good pair, Paulo can reorder the characters in $$$S$$$ and $$$T$$$ as he wishes, tell him what is the best pair $$$(S', T')$$$ such that $$$cost(S', T')$$$ is maximum.

It's guaranteed that the $$$(S, T)$$$ can be made a good pair.

Input

The first line contains the string $$$T$$$ $$$(1 \leq |T| \leq 5)$$$, consisting of only distinct lowercase English letters.

The second line contains the string $$$S$$$ $$$(1 \leq |S| \leq 3\times10^5)$$$, consisting of only lowercase English letters.

Output

On the first line output one integer $$$cost(S', T')$$$, then on the second line output the string $$$S'$$$, then on the third line output $$$T'$$$, such that $$$cost(S', T')$$$ is maximized.

Examples
Input
ahmd
ahmmdddmddm
Output
39
mmmmhddddda
adhm
Input
abd
abbbdddd
Output
19
ddddbbba
abd
Input
juan
juaaannnjj
Output
36
unnnjjjaaa
ajnu
Input
abc
abbcc
Output
8
ccbba
abc