A word search is a matrix of letters as defined in Word Search Puzzle Generation. For a word search to contain a word, it means that that word appears somewhere in the matrix horizontally, vertically, or diagonally.
Your task is to write a program that takes a list of strings and outputs the dimensions of the smallest-area word search that contains those strings.
- You can assume the word search and the input strings consist of only lowercase ASCII letters.
- You can output the dimensions in either order (
y xinstead of
x y) because it doesn't matter to the word search.
- This is code-golf, so the shortest valid solution (in bytes) wins.
word -> 4 1 hello, e -> 5 1 hello, f -> 6 1 small, llama -> 8 1 words, other -> 5 2 words, order, about, orb -> 5 3