Plagiarism Detection#10919

Plagiarism Detection

1 second
64 megabytes
Very hard

During a lesson, the teacher observed that some students' work appeared similar. To streamline the process of identifying similar sections in students' submissions, the teacher decided to create a program that finds the longest common sequence of characters between two lines of text. Your task is to help implement this algorithm.

Input

You will receive two lines of text as input, each with a maximum length of characters.

Output

Your output should be the longest common sequence of characters. If there are multiple sequences of the same length, return the one that comes first in alphabetical order.

h.jpg