12069 - CS_2018_MID1-3   

Description

Given two strings A and B, find the longest symmetric substrings (palindrome) of both A and B.
 
For example, if A is "
aabcbadd" and B is "eebcbe", the answer should be "bcb"

 

Note that there might be more than one longest symmetric substring of A and B.

In that case, you only need to print leftmost substring of A.

Also, note that there is at least one longest symmetric substring of A and B for each test case.

Input

The first two lines of the input are the strings A and B (0 < length of A and B <= 20).

Output

Print the longest symmetric substrings of A and B (leftmost substring of A)

You need to print ‘\n’ at the end of the output.

Sample Input  Download

Sample Output  Download

Tags

==



Discuss