An abbreviation of a word follows the form . Below are some examples of word abbreviations:
1 2 3 4 5 6 7 8 9 10 11 12
a) it --> it (no abbreviation)
1 b) d|o|g --> d1g
111 1---5----0----5--8 c) i|nternationalizatio|n --> i18n
1 1---5----0 d) l|ocalizatio|n --> l10n
Assume you have a dictionary and given a word, find whether its abbreviation is unique in the dictionary. A word’s abbreviation is unique if no other word from the dictionary has the same abbreviation.
Example:
1 2 3 4 5 6
Given dictionary = [ "deer", "door", "cake", "card" ]
// Your ValidWordAbbr object will be instantiated and called as such: // ValidWordAbbr vwa = new ValidWordAbbr(dictionary); // vwa.isUnique("Word"); // vwa.isUnique("anotherWord");