Let us say that we have a particular set of functions on strings. These functions are kind of like fill in the blanks or madlibs, except that they only take one input and use that to fill in all of their blanks. For example we might have a function that looks like
I went to the ____ store and bought ____ today.
If we applied this function to the string cheese
the result would be:
I went to the cheese store and bought cheese today.
We can represent these functions as a non-empty list of strings, where the blanks are simply the gaps in between strings. For example our function above would be:
["I went to the ", " store and bought ", " today."]
With this representation there is only one representation for every function of this sort and only one function for each representation.
A really neat thing is that the set of such functions is closed under composition. That is to say composition of two of our functions is always another one of these functions. For example if I compose our function above with
["blue ", ""]
(the function that prepends blue
to the input)
We get the function:
["I went to the blue ", " store and bought blue ", " today."]
These can get a little more complex though. For example if we compose the first function with
["big ", " and ", ""]
The result is
["I went to the big ", " and ", " store and bought big ", "and", " today."]
Task
Your task is to take two functions as described as non-empty lists of strings and output their composition as a non-empty list of strings.
For the purpose of this challenge a list can be any ordered container that permits duplicates and a string may be a native string type, a list of characters or a list of integers.
This is code-golf answers will be scored in bytes with fewer bytes being better.
Test cases
["","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"]