In the grafix file format, a bitmap is encoded as a sequence of lowercase alphabetic words. All of these words are drawn from a dictionary that has been built specially for the bitmap by a compression algorithm. Each word in the dictionary has the same length.
It can occur that words in a grafix file are corrupted by poor transmission or storage media. In such cases, grafix attempts to reconstruct the original file by matching each corrupted word to a dictionary word that contains one or more of the same characters at the same positions.
You are given a String, dictionary, containing every word in a grafix file's dictionary, and a String, candidate, which is a possibly corrupted word in that file. If there is no dictionary word that has at least one character in the same position as candidate, then return the int value -1. Otherwise, return the zero-based index of the dictionary word that has the greatest number of characters at the same positions as candidate. In the event of a tie, favor the lowest index.
|-||dictionary contains between 1 and 50 elements, inclusive|
|-||candidate is between 1 and 20 characters long, inclusive|
|-||each element of dictionary has the same length as candidate|
|-||only the characters 'a' to 'z' are permitted in candidate and dictionary|