Given a list of words
["Programming", "Puzzles", "Code", "Golf"] output the words crossword-style:
P r o g r a m m i n g u z z G l C o d e l s f
- You have to process the list in the given order.
- The words are printed in alternating orientations, starting horizontally.
The two words intersect at the first letter in the first word which is also present in the second word. If this letter occurs multiple times in the seond word, take the first one.
o n o
n o n
- Adjacent words in the list will have at least one common letter.
["Hi", "there"]is not a valid input.
- Words will never collide. There will always be enough space to print the a word at the first possible intersection.
["Hello", "there", "end", "hello"]is not a valid input
- The matching is case-sensitive.
- Words can expand to the left and to the top.
- The letters of the horizontal words have to be separated by one space.
- The input list will contain at least two words.
- All words will match the regex:
- You may print as many trailing whitespaces or newlines as you want, as long as the words are correctly chained.
- On the other hand you may not add additional leading whitespaces. The word which floats to the left the most has zero leading spaces, the other lines have so many leading spaces that it all lines up correctly.
- You program has to be able to deal with an arbitrary amount of words
- Function or full program allowed.
- Default rules for input/output.
- Standard loopholes apply.
- This is code-golf, so lowest byte-count wins. Tiebreaker is earlier submission.
Input list on the first line, output starts on the second line.
["Stack", "Exchange"] E x c h S t a c k n g e
["This", "site", "graduated", "finally"] f i s n T h i s g r a d u a t e d l e l y