QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 2048 MB Total points: 100

#10594. 直观元素

Statistics

Brandon 正在学习元素周期表!然而,他不喜欢某些元素,因为这些元素的符号中包含的字母在元素名称中并不存在。他觉得这很不直观,特别是因为在其他语境下,他期望缩写不会引入随机字母。

给定一个字符串和一个建议的缩写,请判断 Brandon 是否会觉得它直观。Brandon 认为一个缩写是直观的,当且仅当缩写中出现的每一个字母都在原始字符串中出现过。Brandon 不会仔细检查缩写,因此缩写中某个字母出现的次数多于原始字符串中的次数,或者字母在缩写中的顺序与原始字符串中的顺序不同,都是可以接受的。

输入格式

输入的第一行包含一个整数 $t$ ($1 \le t \le 10^3$),表示测试用例的数量。

每个测试用例由两行组成。 每个测试用例的第一行包含一个长度至少为 2 且最多为 50 的字符串 $a$。该字符串仅包含小写字母。每个测试用例的第二行包含一个严格短于 $a$ 的字符串 $b$,且该字符串也仅包含小写字母。

输出格式

输出 $t$ 行,每行对应一个测试用例。 对于每个测试用例,如果 $b$ 中的所有字母都在 $a$ 中出现,则输出 YES。否则,输出 NO

样例

样例输入 1

4
magnesium
mg
silver
ag
aabb
bbb
aabb
ba

样例输出 1

YES
NO
YES
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.