You are given a goal word as a String matchString and puzzle words as a
The number of puzzle words is equal to the number of letters in the goal word.
Assume all letters in all words have the same width and height.
You want to play a game. At the beginning of the game, all the words from matchWords are arranged one below
another, in the order that they're given. The words are horizontally aligned so that the first letters of all the
words form a vertical line.
You may then shift each of the words any number of places (zero or more) to the right, where one place is the
width of a single letter.
The goal of the game is to shift the puzzle words such that the goal word can be read vertically from top to
bottom in a straight line. See examples for clarification.
Your score is the sum of the number of places each puzzle word was shifted.
Return the minimal score you can obtain while achieving your goal, or -1 if it is impossible.