I’ll tell you how you’ll print the output for one row:
Iterate over the list, print the substring starting from index i*w[i] to (i+1)*w[i] (or till the end of word if less chars are left) then print a “|” and continue…
Iterate over the list of lists doing the same thing for all lists of words…