Ransom Note
Time Limit: 1 Second Memory Limit: 32768 KB
Special Judge
Input
Standard input consists of the text of the note followed by the text of the newspaper. The text of the note is a single line, less than 20KB in length, in lowercase with no punctuation. The text of the newspaper is in upper and lower case with punctuation and newlines mixed in. Case may be ignored (aS IN aNY standard RAnsoM nOTE) and punctuation and newlines should not be clipped. The kidnappers have acquired a large number of copies of the same newspaper, so that the same or overlapping text may be clipped as many times as necessary. Every letter of the alphabet occurs at least once in the newspaper. The newspaper is smaller than 100KB in length.
Output
Print the number of clippings followed by the clippings, on per line, in the correct order to compose the note. The case of the newspaper text should be preserved. If there are several solutions, print the one with the longest first clipping, then the second, and so on. If one clipping appears several times in the newspaper, choose any one.
Sample Input
drop the price on new thermopanes now or else Rain Users Guide While "rain" was intended to be a general purpose tool, at the time of writing the primary goal was to study one particular software system. As a result, some steps that are only done once (such as extracting information from the program under study) are done using cumbersome ad-hoc techniques that require significant manual intervention. While "rain" can be used on arbitrary programs, more development work needs to be done before this is a convenient process.
Sample Output
19 d ro p the pri ce on ne w the rm op an es n o W or el seSubmit
Source: University of Waterloo Local Contest 1996.10.05