spoj#WORD. Wordplay
Wordplay
Ivana made up a long word of N letters. Then she wrote down all K-letter-substrings of that word. For example, if the original word is BANANA and K=3, Ivana writes down the words BAN, ANA, NAN, ANA. The number of these words is, obviously, N-K+1.
Ivana sorted these words in lexicographic order (in the given example, that would be ANA, ANA, BAN, NAN).
But the sad thing happened: Ivana forgot the original word! Your task is to reconstruct it. A unique solution will exist in all of the test data.
Constraints: 3 ≤ N ≤ 100 000, 2 ≤ K ≤ 15, K < N.
Input
[integers N, K]
[N-K+1 words in lexicographic order, each consisting of capital English letters]
Output
[the required word]
Example
Input:6 3 ANA ANA BAN NANOutput:
BANANA