Create a class that, upon initialization, is given a list of words. Implement a method that, given two words firstWord and secondWord, returns the minimum distance (in positions) between these two words in the original list. This method may be called several times with different word pairs.
Input: words = ["learn", "code", "repeat", "test", "code"] WordDistance wd = new WordDistance(words); wd.closestGap("test", "learn"); Output: 3 Input: wd.closestGap("code", "repeat"); Output: 1