309347: CF1666D. Deletive Editing

Memory Limit:512 MB Time Limit:3 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Deletive Editing

题意翻译

题目描述: 黛西喜欢玩文字游戏。 最近,她一直在和丹尼尔玩以下删除编辑文字游戏。 Daisy 选择了一个词,例如“DETERMINED”。 在每个游戏回合中,丹尼尔喊出一个字母,例如“E”,黛西从单词中删除该字母的第一次出现,得到“DTERMINED”。 下一回合,Daniel 再次喊出一个字母,例如“D”,Daisy 删除了它的第一次出现,得到“TERMINED”。 他们继续使用“I”,得到“TERMNED”,使用“N”,得到“TERMED”,使用“D”,得到“TERME”。 现在,如果丹尼尔喊出字母“E”,黛西会得到“TRME”,但如果他们开始玩“DETERMINED”这个词,她就不可能得到“TERM”这个词。 黛西很好奇她是否可以通过玩这个游戏零个或多个回合从给定的初始单词开始获得她选择的最终单词。 你的任务可以帮助她解决这个问题。 输入: 第一行是数据组数$t$,接下来给出$t$行,每行两个字符串,黛西选择的字符串和最终单词

题目描述

Daisy loves playing games with words. Recently, she has been playing the following Deletive Editing word game with Daniel. Daisy picks a word, for example, "DETERMINED". On each game turn, Daniel calls out a letter, for example, 'E', and Daisy removes the first occurrence of this letter from the word, getting "DTERMINED". On the next turn, Daniel calls out a letter again, for example, 'D', and Daisy removes its first occurrence, getting "TERMINED". They continue with 'I', getting "TERMNED", with 'N', getting "TERMED", and with 'D', getting "TERME". Now, if Daniel calls out the letter 'E', Daisy gets "TRME", but there is no way she can get the word "TERM" if they start playing with the word "DETERMINED". Daisy is curious if she can get the final word of her choice, starting from the given initial word, by playing this game for zero or more turns. Your task it help her to figure this out.

输入输出格式

输入格式


The first line of the input contains an integer $ n $ — the number of test cases ( $ 1 \le n \le 10\,000 $ ). The following $ n $ lines contain test cases. Each test case consists of two words $ s $ and $ t $ separated by a space. Each word consists of at least one and at most 30 uppercase English letters; $ s $ is the Daisy's initial word for the game; $ t $ is the final word that Daisy would like to get at the end of the game.

输出格式


Output $ n $ lines to the output — a single line for each test case. Output "YES" if it is possible for Daisy to get from the initial word $ s $ to the final word $ t $ by playing the Deletive Editing game. Output "NO" otherwise.

输入输出样例

输入样例 #1

6
DETERMINED TRME
DETERMINED TERM
PSEUDOPSEUDOHYPOPARATHYROIDISM PEPA
DEINSTITUTIONALIZATION DONATION
CONTEST CODE
SOLUTION SOLUTION

输出样例 #1

YES
NO
NO
YES
NO
YES

Input

题意翻译

题目描述: 黛西喜欢玩文字游戏。 最近,她一直在和丹尼尔玩以下删除编辑文字游戏。 Daisy 选择了一个词,例如“DETERMINED”。 在每个游戏回合中,丹尼尔喊出一个字母,例如“E”,黛西从单词中删除该字母的第一次出现,得到“DTERMINED”。 下一回合,Daniel 再次喊出一个字母,例如“D”,Daisy 删除了它的第一次出现,得到“TERMINED”。 他们继续使用“I”,得到“TERMNED”,使用“N”,得到“TERMED”,使用“D”,得到“TERME”。 现在,如果丹尼尔喊出字母“E”,黛西会得到“TRME”,但如果他们开始玩“DETERMINED”这个词,她就不可能得到“TERM”这个词。 黛西很好奇她是否可以通过玩这个游戏零个或多个回合从给定的初始单词开始获得她选择的最终单词。 你的任务可以帮助她解决这个问题。 输入: 第一行是数据组数$t$,接下来给出$t$行,每行两个字符串,黛西选择的字符串和最终单词

加入题单

算法标签: