Word
문제
Consider a set of k strings {S1, S2, . . . , Sk} where every character used in the k strings is either a space or any of the 26 characters in { ‘a’, ‘b’, ‘c’, . . ., ‘z’ }. For some constants ℓ and d, our aim is to compute an (ℓ, d)-pattern for {S1, S2, . . . , Sk}. An (ℓ, d)-pattern is a length-ℓ string W = W[1]W[2] . . . W[ℓ] which satisfies the following property:
- For every string Si (i = 1, 2, . . . , k), there exists a length-ℓ substring X = X[1]X[2] . . . X[ℓ] of Si such that the hamming distance of X and W is less than or equal to d. (The hamming distance of X and W is the number of pairs of (X[j], W[j]) such that X[j] ≠ W[j], for j = 1, 2, . . . , ℓ.)
In this task, you are given numbers ℓ and d and a set of strings; you need to compute an (ℓ, d)-pattern for the given set of strings. You can assume that an (ℓ, d)-pattern exists and is unique.
입력
The first line contains two integers ℓ and d separated by a space, where 1 ≤ ℓ ≤ 10 and 0 ≤ d ≤ 2. The second line contains the integer k, where 1 ≤ k ≤ 30. The remaining k lines contain the k strings S1, S2, . . . , Sk. (Each string is of length at most 50.)
출력
The output file contains a string of length ℓ.
This string represents an (ℓ, d)-pattern for the set of strings and ℓ and d given in the input file. The input is always such that there exists exactly one (ℓ, d) pattern.
예제
예제 1
5 1 4 you have two applas i am an ppple we are acples adples are good for health
apple
예제 2
3 0 3 oil is expensive we have three oilers be more oily
oil