The easy one

1

1 votes
Brute Force, Strings, Easy
Problem

There are T test cases. For each test case :

There are two strings A and B (both contain only lowercase latin letters) of the same length and another integer L. Find that substring of A of length L that requires the minimum number of changes to make it to the corresponding substring of string B. If there are multiple such substrings, choose the lexicographically smallest one.

Note: A change means replacing one character at a position by another character at the same position. No other operations are allowed.

Constraints :

1 <= T <= 10

1  <=  length of A, <=100

1 <=L<=length of A,B

 

Input Format:

First line contains the number of test case, T.

For each of those T lines, there are 2 string representing A and B and an integer representing L.

 

Output Format:

Display the required result for each test case in a new line.

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

For the first test case, the two substrings of length 3 in A and their corresponding susbstring in B are : {abc,agc} and {bcd,gcf}.

One change is required in the first case while two are required in the second case. Hence the nasnwer is abc.

Editor Image

?