|
||||||||||
Similar StringsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 810 Accepted Submission(s): 297 Problem Description Putting two similar strings together will create a very strong power that can quake the earth into parts and the person who did that can be called the Destroyer of the World. In order to stop the Destroyer of the World, WNJXYK decided to check every string in this world to make sure there is no pair of strings are similar. But some strings are too long that WNJXYK cannot judge whether they are similar to others, so he turns to you for help. Now WNJXYK need you to determine the maximum s, for string A has a substring A’ and string B has a substring B’ whose length are both s and they differ on at most K positions. Input The input starts with one line contains exactly one positive integer T which is the number of test cases. Each test case contains three lines. The first line contains an integer K and each of the following two lines contains a string indicates stringA or stringB Output For each test case, output one line containing “y” where y is the maximum s. Sample Input
Sample Output
Hint 1<=T<=5,1<=len(A),len(B)<=4000,0<=K<=min{len(A),len(B)} Strings only contain lowercase English letters. Source | ||||||||||
|