#P4470. [BJWC2018] 售票

    ID: 3400 远端评测题 1000ms 250MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>模拟字符串2018北京枚举,暴力

[BJWC2018] 售票

Description

A new type of automatic ticket machine has appeared at the train station in city C. When buying a ticket, the passenger first enters the destination name on the machine. There are NN destinations in total. As the passenger types each letter in order, the number of candidate destinations gradually decreases.

On the machine screen, there is a keyboard with 44 rows and 88 columns, as shown in the figure below.

After each letter is entered, only the valid characters on the keyboard are selectable (depending on the remaining candidate destinations), and the other letters are replaced by the character *.

Given the names of NN destinations and the characters already typed by the passenger, output the current state of the keyboard.

Input Format

The first line contains an integer NN (1N501 \leq N \leq 50). The next NN lines each contain a string of uppercase English letters with length at most 100100, representing a destination. The last line contains a string with length at most 100100, representing the characters typed in order.

Output Format

Output 44 lines, each being a string of length 88, representing the keyboard state.

4
ZAGREB
SISAK
ZADAR
ZABOK
ZA
****B*D*
*G******
********
********

Hint

Sample explanation:

After typing ZA, the next character could be G (the destination could be ZAGREB), or D (the destination could be ZADAR), or B (the destination could be ZABOK).

Translated by ChatGPT 5