word of lowercase Latin letters in which every letter that appears does so exactly twice. You also get an array gaps of length 26: gaps[0] belongs to a, gaps[1] to b, and so on up to z.
The string fits if, for every letter it contains, the number of letters between that letter's two occurrences equals the matching entry in gaps. Entries for letters missing from the string are ignored.
Return True if the string fits, and False otherwise.word="kxkx", gaps=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0] → True
There is one letter between the two ks and one between the two xs, exactly what gaps[10] and gaps[23] ask for. The other entries do not matter.
word="bccb", gaps=[0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] → False
The two cs are side by side with 0 letters between them, but gaps[2] asks for 1.
word consists of lowercase Latin lettersword appears exactly twiceword="kxkx", gaps=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]
True
Run checks the first 3 tests in your browser. Submit checks all 30 tests on the server, hidden ones included.