Lines#2198

Lines

1 second
64 megabytes
Very easy

A string \textbf{A} = a_1 a_2 \ldots a_n is called a substring of a string \textbf{B} = b_1 b_2 \ldots b_m if there exists an integer (1 \leq k \leq m - n + 1) such that a_1 = b_k, a_2 = b_{k+1}, , a_n = b_{k+n-1}.

A string is called a superstring of if is a substring of .

A string \textbf{A} = a_1 a_2 \ldots a_n is lexicographically smaller than a string \textbf{B} = b_1 b_2 \ldots b_m if there exists an integer such that a_t = b_t for all 1 \leq t \leq k, and either a_{k+1} < b_{k+1}, or the length of is and the length of is greater than .

Given strings and , find a string that is both a substring of and a superstring of . If there are multiple such strings, output the longest one. If there are several strings of maximum length, output the lexicographically smallest one.

Input

The first line contains the string (1 \leq |\textbf{S}| \leq 4000). The second line contains the string (1 \leq |\textbf{T}| \leq 4000). Both strings consist of lowercase Latin letters. Here, and denote the lengths of the strings and , respectively.

Output

Output the required string, or NO SOLUTION if there is no such string.

Examples

Example 1

Loading
Loading