QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 2048 MB 總分: 100

#5734. 发放车牌

统计

你需要编写代码来检查车牌号。车牌号由大写字母 ‘A’–‘Z’ 和数字 ‘0’–‘9’ 组成。你需要确保这些代码不包含任何违禁词,即使考虑到“火星文”(leetspeak)的情况也是如此。

给定一些输入字符串,判断哪些是有效的车牌号?

在火星文中,我们有以下等价关系:0=O, 1=L, 2=Z, 3=E, 5=S, 6=B, 7=T, 8=B。

输入格式

第一行包含整数 $N$ 和 $M$,其中 $0 \le N, M \le 100$。接下来有 $N$ 行,每行包含一个违禁词;每个词仅包含大写字母(‘A’–‘Z’),长度不超过 25 个字符。随后有 $M$ 行,每行包含一个待检查的车牌号;每个车牌号仅包含大写字母和数字(‘0’–‘9’),长度不超过 25 个字符。

输出格式

输出共 $M$ 行,每行对应一个车牌号,顺序与输入中的顺序一致。如果车牌号有效,输出字符串 ‘VALID’;否则输出字符串 ‘INVALID’。

样例

样例输入 1

7 2
AWFUL
BAD
CRUMMY
LOUSY
POOR
SAD
TERRIBLE
SO5OD
TROUBADOUR

样例输出 1

VALID
INVALID

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.