시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 0 | 0 | 0 | 0.000% |
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:
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.
5 1 4 you have two applas i am an ppple we are acples adples are good for health
apple
3 0 3 oil is expensive we have three oilers be more oily
oil