The given input (STDIN/filename) is composed by a variable number of lines. Each input line represents the possible values for the n-th character of each output line. The number of lines of the input is equal to the length of each output line.
For example, given the following input:
ps
o
s
t
ae
The desired output is:
posta
poste
sosta
soste