UVa 10100: Longest Match (Solution)

21:15:00 Multiple PC World 0 Comments

Longest Match
A newly opened detective agency is struggling with their limited intelligence to find out a secret information passing technique among its detectives. Since they are new in this profession, they know well that their messages will easily be trapped and hence modified by other groups. They want to guess the intensions of other groups by checking the changed sections of messages. First they have to get the length of longest match. You are going to help them.


The input may contain multiple test cases. Each case will contain two successive lines of string. Blank lines and non-letter printable punctuation characters may appear; any letter or digit is considered to be a letter character. Each line will be no longer than 1000 characters. Length of each word will at most 20 characters long.

The input must be read from standard input.


For each case of input, you have to output a line starting with the case number right justified in a field width of two columns, followed by the longest match as shown in the sample output. In case of at least one blank line for each input output ‘Blank!’. Consider the non-letter characters as white-spaces.

The output must be written to standard output.

Sample Input

This is a test.

The document provides late-breaking information
late breaking.

Sample Output

1. Length of longest match: 1
2. Blank!
3. Length of longest match: 2


0 comentarios: