#P12817. [NERC 2021] Deletive Editing
[NERC 2021] Deletive Editing
题目描述
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, . On each game turn, Daniel calls out a letter, for example, , and Daisy removes of this letter from the word, getting . On the next turn, Daniel calls out a letter again, for example, , and Daisy removes its first occurrence, getting . They continue with , getting , with , getting , and with , getting . Now, if Daniel calls out the letter , Daisy gets , but there is no way she can get the word if they start playing with the word .
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 --- the number of test cases (). The following lines contain test cases.
Each test case consists of two words and separated by a space. Each word consists of at least one and at most 30 uppercase English letters; is the Daisy's initial word for the game; is the final word that Daisy would like to get at the end of the game.
输出格式
Output lines to the output --- a single line for each test case. Output if it is possible for Daisy to get from the initial word to the final word by playing the Deletive Editing game. Output otherwise.
6
DETERMINED TRME
DETERMINED TERM
PSEUDOPSEUDOHYPOPARATHYROIDISM PEPA
DEINSTITUTIONALIZATION DONATION
CONTEST CODE
SOLUTION SOLUTION
YES
NO
NO
YES
NO
YES