QOJ.ac

QOJ

时间限制: 2 s 内存限制: 1024 MB

#23618. Austere Sign

统计

We are going to paint a sign but we can only afford stencils for $k$ letters. Update the text of the sign to use only $k$ unique letters without changing the lengths of any of the words, so that we can subtly fix the sign later.

problem_23618_b9a2f08858b6f3bc9138924a04eac634.png

Figure A.1: Illustration of Sample Input 1. You can do this!

Input

  • The first line of input contains the number of words, $n$ ($1 \le n \le 1000$), and the number of letters, $k$ ($1 \le k \le 26$).
  • The second line of input contains $n$ words. Each word consists of between $1$ and $20$ lowercase latin letters.

Output

Output a phrase using at most $k$ distinct letters, substituting as few from the original text as possible. If there are multiple possible answers, output any.

Examples

Input 1

2 3
good luck

Output 1

lool lull

Input 2

3 1
this is hard

Output 2

ssss ss ssss

Input 3

1 6
impossible

Output 3

imbossibee

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.