QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 512 MB Points totaux : 100

#3344. 字母饼干

Statistiques

Sætre 终于决定让他们著名的字母饼干重新上市了。当然,它们既有趣又好吃。你的小妹妹正试图用她在盒子里找到的字母拼出单词,但你想比她更快地判断出是否能够拼出这些单词。

给定饼干盒里的字母,判断是否能够拼出你小妹妹想拼的单词?(拼出一个单词后,她会把饼干重新打乱,因此后续的单词可以重复使用这些字母。)

输入格式

输入的第一行包含一个整数 $T$,表示你妹妹拥有的字母饼干盒的数量。每个测试用例以一行描述该盒中所有字母的字符串开始(字母顺序不固定)。接下来是一行包含 $W$ 的内容,表示她想要拼出的单词数量,随后是 $W$ 行,每行一个单词。

输出格式

对于每个单词,如果能够拼出该单词,输出一行 YES,否则输出 NO

数据范围

  • $0 < T \le 100$
  • $0 < W \le 100$
  • 所有字母均为英文字母大写(A-Z)。
  • 每个饼干盒中最多有 1000 个字母。
  • 每个单词最多有 100 个字母(但不一定是真实的英语单词)。

样例

输入格式 1

1
ABANANACOOKIE
4
BANANA
LETTER
COOKIES
CAN

输出格式 1

YES
NO
NO
YES

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.