英语翻译—1.17号
题目来源: https://acs.jxnu.edu.cn/problem/POJ2192
Zipper
拉链
1000ms 65536K
描述:
Given three strings, you are to determine whether the third string can be formed by combining the characters in the first two strings. The first two strings can be mixed arbitrarily, but each must stay in its original order.给你三个字符串,你要确定第三个字符串是否能被前两个字符串的结构拼接,这前两个字符串可以被混合,但是每一个每个(字符串)必须保持原来的排列顺序。
For example, consider forming "tcraete" from "cat" and "tree":
例如:考虑由“cat","tree"所构成的“tcraete" String A: cat
String B: tree
String C: tcraete
字符串A:cat 字符串B:tree 字符串C:tcraete
As you can see, we can form the third string by alternating characters from the two strings. As a second example, consider forming "catrtee" from "cat" and "tree":
正如你所看到的,我们可以通过交替前两个字符串的字符来组成第三个字符串。如第二个例子:考虑由”cat“”tree“来组成”catrtee”:
String A: cat
String B: tree
String C: catrtee
字符串A:cat 字符串B:tree 字符串C:catrtee
Finally, notice that it is impossible to form "cttaree" from "cat" and "tree". 最后,注意到不可能通过“cat"”tree"组成“cttaree"
输入:
The first line of input contains a single positive integer from 1 through 1000. It represents the number of data sets to follow. The processing for each data set is identical. The data sets appear on the following lines, one data set per line.第一行输入包括一单独的正整数(从1到1000)。表示后面测试数据集的数目。每个测试数据集的处理都是相同的。测试数据集存在以下的几行中,一个测试数据集单独占一行。
For each data set, the line of input consists of three strings, separated by a single space. All strings are composed of upper and lower case letters only. The length of the third string is always the sum of the lengths of the first two strings. The first two strings will have lengths between 1 and 200 characters, inclusive. 对于每一个数据集,这一行包含着三个字符串,用一个空格隔开。所有的字符串仅由大写和小写字母组成。第三个字符串的长度等于前两个字符串长度的和。前两个字符串长度均在1和200之间,包括的····
输出:
For each data set, print:对于每一个测试数据集,输出(打印):
Data set n: yes
数据集n:yes
if the third string can be formed from the first two, or
如果第三个字符串能由前两个字符串交替组成,否则
Data set n: no
数据集n: no
if it cannot. Of course n should be replaced by the data set number. See the sample output below for an example. 如果不能。当然n代表的是数据集的编号。有关示例,请参见下面的示例输出。
样例输入:
3 cat tree tcraete cat tree catrtee cat tree cttaree
样例输出:
Data set 1: yes Data set 2: yes Data set 3: no