QOJ.ac

QOJ

Límite de tiempo: 1.0 s Límite de memoria: 512 MB Puntuación total: 100 Hackeable ✓

#16859. 恶作剧

Estadísticas

Katya 用积木拼出了单词 $s_1$,但当她回到房间时,她看到她的弟弟 Andrey 跑了出去。现在用积木拼出的单词看起来不一样了 —— 变成了 $s_2$。Andrey 承认他开了一个小玩笑。他的恶作剧如下:Andrey 会选择一个位置,然后在该位置插入两个带有相同字母的相邻积木。他可以将这两个积木放在字符串的开头、字符串的末尾,或者两个相邻积木之间。

帮助 Katya 确定 Andrey 是否说了实话,即字符串 $s_2$ 是否可以通过进行若干次恶作剧从字符串 $s_1$ 得到。

输入格式

每个测试点包含多组输入数据。

第一行包含一个整数 $t$ —— 输入数据的组数($1 \le t \le 500\,000$)。

对于每组数据: 第一行包含一个字符串 $s_1$ —— Katya 最初拥有的积木单词。 第二行包含一个字符串 $s_2$ —— Andrey 最终得到的积木单词。

保证所有单词均由小写英文(拉丁)字母组成。所有单词的总长度不超过 $1\,000\,000$。

输出格式

对于每组输入数据,如果 Andrey 可能说了实话,输出 "YES";否则输出 "NO"。

样例

输入样例 1

2
hello
havvaeeello
test
tesssst

输出样例 1

YES
NO

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.