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.


abcd efgh abefcgdh
what up whatup
what up upwhat
yerps cbace cyberspace
yerpc cbsae cyberspace
these are crazy
000000 000000 00000000000
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
The output formats:
□no:□l□~□r□=?□c "□" represent a whitespace

9 人解决,26 人已尝试。

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

7.7 EMB 奖励。

创建: 14 年,7 月前.

修改: 5 年,5 月前.

最后提交: 1 年,10 月前.

来源: N/A