1029: Delete characters
[Creator : ]
Description
Given a string S and a string array, find the longest string in the array that can be formed by deleting some characters of S. If there are more than one possible results, return all of them in ascending order. If there is no possible result, return the "Impossible"
Input
The first line contains and integer N and S (N is integer which is the number of string in the array, S is the string)
The next N line, each line contains one string (For this problem, upper case and lower case are the same, but for output, use lower case)
1 <= N <= 1000 and 1<= |S| <= 1000
The next N line, each line contains one string (For this problem, upper case and lower case are the same, but for output, use lower case)
1 <= N <= 1000 and 1<= |S| <= 1000
Output
Output the strings
Sample Input Copy
5 ToSoochooarklm
Tom
orange
market
school
house
Sample Output Copy
school
tom