306418: CF1194C. From S To T
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:1
Solved:0
Description
From S To T
题意翻译
## 题目描述 你将会得到三个由小写拉丁字符组成的字符串 $s, t, p$ 每一次操作中,你可以在 $p$ 中任意选出一个字符删去并插入在 $s$ 中的任意一个位置 例如当 $p$ 为 $\text{aba}$,$s$ 为 $\text{de}$,则以下操作都是合法的 $\text{aba} \rightarrow \text{ba}, \text{de} \rightarrow \text{ade}$ $\text{aba} \rightarrow \text{ba}, \text{de} \rightarrow \text{dae}$ $\text{aba} \rightarrow \text{ba}, \text{de} \rightarrow \text{dea}$ $\text{aba} \rightarrow \text{aa}, \text{de} \rightarrow \text{bde}$ $\text{aba} \rightarrow \text{aa}, \text{de} \rightarrow \text{dbe}$ $\text{aba} \rightarrow \text{aa}, \text{de} \rightarrow \text{deb}$ $\text{aba} \rightarrow \text{ab}, \text{de} \rightarrow \text{ade}$ $\text{aba} \rightarrow \text{ab}, \text{de} \rightarrow \text{dae}$ $\text{aba} \rightarrow \text{ab}, \text{de} \rightarrow \text{dea}$ 你的任务是检验是否能经过若干次操作(可能零次),将 $s$ 变为 $t$ ## 输入输出格式 ### 输入格式: 多组数据 第一行包括一个正整数 $q(1\leq q \leq 100)$,描述了数据的组数 对于每一组数据,都会由三排组成 第一排为由小写拉丁字符组成的字符串 $s(1 \leq |s| \leq 100)$ 第二排为由小写拉丁字符组成的字符串 $t(1 \leq |t| \leq 100)$ 第三排为由小写拉丁字符组成的字符串 $p(1\leq |p| \leq 100)$ ### 输出格式 如果能够对 $s$ 进行若干次操作使其变为 $t$,请输出 $\text{YES}$,否则输出 $\text{NO}$题目描述
You are given three strings $ s $ , $ t $ and $ p $ consisting of lowercase Latin letters. You may perform any number (possibly, zero) operations on these strings. During each operation you choose any character from $ p $ , erase it from $ p $ and insert it into string $ s $ (you may insert this character anywhere you want: in the beginning of $ s $ , in the end or between any two consecutive characters). For example, if $ p $ is aba, and $ s $ is de, then the following outcomes are possible (the character we erase from $ p $ and insert into $ s $ is highlighted): - aba $ \rightarrow $ ba, de $ \rightarrow $ ade; - aba $ \rightarrow $ ba, de $ \rightarrow $ dae; - aba $ \rightarrow $ ba, de $ \rightarrow $ dea; - aba $ \rightarrow $ aa, de $ \rightarrow $ bde; - aba $ \rightarrow $ aa, de $ \rightarrow $ dbe; - aba $ \rightarrow $ aa, de $ \rightarrow $ deb; - aba $ \rightarrow $ ab, de $ \rightarrow $ ade; - aba $ \rightarrow $ ab, de $ \rightarrow $ dae; - aba $ \rightarrow $ ab, de $ \rightarrow $ dea; Your goal is to perform several (maybe zero) operations so that $ s $ becomes equal to $ t $ . Please determine whether it is possible. Note that you have to answer $ q $ independent queries.输入输出格式
输入格式
The first line contains one integer $ q $ ( $ 1 \le q \le 100 $ ) — the number of queries. Each query is represented by three consecutive lines. The first line of each query contains the string $ s $ ( $ 1 \le |s| \le 100 $ ) consisting of lowercase Latin letters. The second line of each query contains the string $ t $ ( $ 1 \le |t| \le 100 $ ) consisting of lowercase Latin letters. The third line of each query contains the string $ p $ ( $ 1 \le |p| \le 100 $ ) consisting of lowercase Latin letters.
输出格式
For each query print YES if it is possible to make $ s $ equal to $ t $ , and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
输入输出样例
输入样例 #1
4
ab
acxb
cax
a
aaaa
aaabbcc
a
aaaa
aabbcc
ab
baaa
aaaaa
输出样例 #1
YES
YES
NO
NO