logo AlgoBeat OnlineJudge
登录 注册

#213041. [NERC 2019] Lexicography

内存限制:512 MiB 时间限制:3000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Lucy likes letters. She studied the definition of the lexicographical order at school and plays with it.

At first, she tried to construct the lexicographically smallest word out of given letters. It was so easy! Then she tried to build multiple words and minimize one of them. This was much harder!

Formally, Lucy wants to make words of length each out of the given letters, so that the -th of them in the lexicographic order is lexicographically as small as possible.

输入格式

The first line contains three integers , , and (; ) --- the total number of words, the length of each word, and the index of the word Lucy wants to minimize.

The next line contains a string of lowercase letters of the English alphabet.

输出格式

Output words of letters each, one per line, using the letters from the input. Words must be sorted in the lexicographic order, and the -th of them must be lexicographically as small as possible. If there are multiple answers with the smallest -th word, output any of them.

样例

样例输入 1

3 2 2
abcdef

样例输出 1

af
bc
ed

样例输入 2

2 3 1
abcabc

样例输出 2

aab
bcc