2153. Combination

单点时限: 2.0 sec

内存限制: 256 MB

In this program, we will determine if it is possible to produce a target string by interleaving the characters of two source strings. When two strings come together, we won’t require one-by-one alternation and will allow any number of successive characters of one source string to come between two successive characters of the other source string.

输入格式

The first line of input gives the number of cases, N(1<=N<=20). N test cases follow.Each line of input will contain three nonempty strings of non-blank graphical ASCII characters separated by single blank characters. The first two strings are known as the left source string l and the right source string r, and the third string is known as the target string c.All strings’length is less than 40.

输出格式

For each line of input, determine whether or not the target string c contains a subsequence that matches the left source string l, and by removing the characters of l from c leaves the right source string r. Answer yes or no followed by the source strings and target string formatted as shown in the output sample.

样例

Input
7
abcd efgh abefcgdh
what up whatup
what up upwhat
yerps cbace cyberspace
yerpc cbsae cyberspace
these are crazy
000000 000000 00000000000
Output
yes: abcd ~ efgh =? abefcgdh
yes: what ~ up =? whatup
yes: what ~ up =? upwhat
no: yerps ~ cbace =? cyberspace
yes: yerpc ~ cbsae =? cyberspace
no: these ~ are =? crazy
no: 000000 ~ 000000 =? 00000000000
Hint:
The output formats:
yes:□l□~□r□=?□c
□no:□l□~□r□=?□c "□" represent a whitespace

9 人解决,26 人已尝试。

9 份提交通过,共有 75 份提交。

7.7 EMB 奖励。

创建: 16 年,5 月前.

修改: 7 年,2 月前.

最后提交: 3 年,7 月前.

来源: N/A

题目标签