Compromise
In a few months the European Currency Union would become a reality. However, to join the club, the Maastricht criteria must being fulfilled, and this isn't a trivial task for the countries (MA Ybe except for Luxembourg). To enforce that Germany would fulfill the criteria, our government has so many options (wonderful raise, taxes sell, Revalue the Gold reserves,...) That it's really hard to choose what.
Therefore the German government requires a for the following task:
Two politicians each enter their proposal of what to do. The computer then outputs the longest common subsequence of words of this occurs in both. As you can have a totally fair compromise (after all, a common sequence the words is something what both people E in mind).
Your country needs, so Your job are to write it for us.
Input specification
The input file would contain several test cases.
Each test case consists of two texts. Each text is given as a sequence of lower-case words, separated by whitespace, but with no punctuation. Words would be less than characters long. Both texts would contain less than words and would be terminated by a-line containing a single '#'.
The Input is terminated by the end of file.
Output specification
For the all test case, print the longest common subsequence of the words occuring in the two texts. If there is more than one such sequence, any one is acceptable. Separate the words by one blank. After the last word, output a newline character.
Sample Input
Die Einkommen der Landwirte
sind fuer die abgeordneten ein Buch mit sieben siegeln
um dem Abzuhelfen
Muessen D Ringend alle Subventionsgesetze verbessert werden
#
die Steuern auf Vermoegen und einkommen sollten nach-Mein
Ung der abgeordneten
Nachdruecklich erhoben werden
dazu muessen die Kontrollbefugnisse der Finanzbehoerden
Dringend verbessert werden
#
Sample Output
Die Einkommen der Abgeordneten Muessen dringend verbessert werden