QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 1024 MB

#23618. Insegna austera

الإحصائيات

Stiamo per dipingere un'insegna ma possiamo permetterci gli stencil solo per $k$ lettere. Aggiorna il testo dell'insegna in modo da usare solo $k$ lettere distinte senza cambiare la lunghezza di nessuna delle parole, così da poter sistemare discretamente l'insegna in un secondo momento.

problem_23618_b9a2f08858b6f3bc9138924a04eac634.png

Figura A.1: Illustrazione dell'esempio di input 1. Ce la puoi fare!

Input

  • La prima riga di input contiene il numero di parole, $n$ ($1 \le n \le 1000$), e il numero di lettere, $k$ ($1 \le k \le 26$).
  • La seconda riga di input contiene $n$ parole. Ogni parola è composta da un numero di lettere latine minuscole compreso tra $1$ e $20$.

Output

Stampa una frase che utilizzi al massimo $k$ lettere distinte, sostituendone il minor numero possibile rispetto al testo originale. Se esistono più risposte possibili, stampane una qualsiasi.

Esempi

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.