假设我们在字符串上有一组特定的函数。这些函数有点像填入空格或madlib,不同之处在于它们仅接受一个输入并使用该输入来填入所有空白。例如,我们可能有一个看起来像
I went to the ____ store and bought ____ today.
如果我们将此功能应用于字符串cheese
,结果将是:
I went to the cheese store and bought cheese today.
我们可以将这些函数表示为字符串的非空列表,其中的空格只是字符串之间的空白。例如,我们上面的函数将是:
["I went to the ", " store and bought ", " today."]
在这种表示形式下,此类每种功能只有一种表示形式,而每种表示形式仅一种功能。
一件真正整洁的事情是,这些功能的集合在组合时是封闭的。也就是说,我们两个功能的组合始终是这些功能中的另一个。例如,如果我用
["blue ", ""]
(添加blue
到输入的函数)我们得到函数:
["I went to the blue ", " store and bought blue ", " today."]
这些可能会变得更加复杂。例如,如果我们用
["big ", " and ", ""]
结果是
["I went to the big ", " and ", " store and bought big ", "and", " today."]
任务
您的任务是采用描述为字符串的非空列表的两个函数,并将它们的组成作为字符串的非空列表输出。
出于此挑战的目的,列表可以是允许重复的任何有序容器,字符串可以是本机字符串类型,字符列表或整数列表。
这是代码高尔夫球答案,将以字节计分,而字节越少越好。
测试用例
["","xy"] ["ab",""] -> ["ab","xy"]
["x","y","z"] ["a","b"] -> ["xa","bya","bz"]
["xy"] ["ab"] -> ["xy"]
["","",""] ["a",""] -> ["a","a",""]
["x",""] ["","",""] -> ["x","",""]
["x","y","z"] ["a","b","c"] -> ["xa","b","cya","b","cz"]
["x","x","x"] ["a"] -> ["xaxax"]
["w","x","y","z"] ["ab","cd","e"] -> ["wab","cd","exab","cd","eyab","cd","ez"]