QOJ.ac

QOJ

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

#23618. 검소한 간판

统计

우리는 간판을 칠하려고 하지만, $k$개의 글자에 대한 스텐실만 살 여유가 있습니다. 나중에 간판을 감쪽같이 고칠 수 있도록, 어떤 단어의 길이도 바꾸지 않으면서 오직 $k$개의 서로 다른 글자만 사용하도록 간판의 텍스트를 수정하세요.

problem_23618_b9a2f08858b6f3bc9138924a04eac634.png

그림 A.1: 예제 입력 1의 그림. 당신은 할 수 있습니다!

입력

  • 입력의 첫 번째 줄에는 단어의 개수 $n$ ($1 \le n \le 1000$)과 글자의 개수 $k$ ($1 \le k \le 26$)가 주어집니다.
  • 입력의 두 번째 줄에는 $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.