QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB

#23618. 質素な看板

Statistics

私たちは看板を塗ろうとしていますが、$k$ 種類の文字のステンシルしか買う余裕がありません。後で看板をさりげなく直せるように、どの単語の長さも変えずに $k$ 種類の文字だけを使うように看板のテキストを更新してください。

problem_23618_b9a2f08858b6f3bc9138924a04eac634.png

図 A.1: サンプル入力 1 の図解。あなたならできます!

入力

  • 入力の 1 行目には、単語の個数 $n$ ($1 \le n \le 1000$) と文字の種類数 $k$ ($1 \le k \le 26$) が与えられます。
  • 入力の 2 行目には $n$ 個の単語が与えられます。各単語は $1$ 文字以上 $20$ 文字以下の英小文字からなります。

出力

元のテキストからの置換回数をできるだけ少なくして、高々 $k$ 種類の異なる文字を使用したフレーズを出力してください。可能な答えが複数ある場合は、どれを出力しても構いません。

入出力例

入力 1

2 3
good luck

出力 1

lool lull

入力 2

3 1
this is hard

出力 2

ssss ss ssss

入力 3

1 6
impossible

出力 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.