EDITV2 - Edit Distance Variant 2

Description:

As you studied in the subject "Dynamic Programming" you can program a variant of the Edit Distance algorithm, to implement a Longest Common Subsequence algorithm.

In this problem, you will have to implement a Longest Common Subsequence algorithm.

Input

The input comes in two lines, in the first line, you will have a string s, in the second line you will have a string t.

Output

You will have to inform the longest scattered string of characters which is included within both words (s and t).

Example

Input:
Argentina
gienote



Output:

gent

Added by:Coach UTN FRSF
Date:2011-07-18
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2014-11-01 16:37:52 Nadia
Hi, I think the problem is ambiguous, it does not specify what should be done if two subsequences of the same length are found.

Last edit: 2014-11-01 16:38:10
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.