Elf in String 2

1000ms    10000K
207    73
Beginner

Description

You have found the Elves here.

Elves don't like to be found. So, they change the way they live in string. Elves live in two strings. The longgest common substring is the elf.

e.g. in 12345abcde and 9876545a23124  "45a" is the longgest common substring. This is the elf.

Input

There are mulitple test cases.

Each test case contain two strings in one row. (the lenght of string <= 100, the lenght of elf > 2)

Output

For each test case, find the elf and print out in one row.

Sample Input

12345abcde 9876545a32164
abcdefg poicdefaf3

Sample Output

45a
cdef

Hint

Source

Editor

keefo on 2015-01-23 02:20:45


North University of China

OnlineJudge

NUC

NOJ

OJ

ACM/ICPC