Given a string S consisting only of lowercase letters a through z and spaces (or a list of words), find the number of letters in the shortest pangrammatic window in S, that is, the size of the span of letters containing all 26 letters of the alphabet with the fewest letters.
You should output 0 if no such window exists in the input.
"" → 0 "not yet" → 0 "bcdefghijklmnopqrstuvwxyz" → 0 "abcdefghijklmnopqrstuvwxyz" → 26 "rnhduotgmbeizwsfkyqapvcjlx" → 26 "the quick brown fox jumps over the lazy dog" → 32 "a quizzical romantic night with experts through the hills and valleys just feels bleaker and queerer than before" → 72
[] → 0 ["n", "o", "t", " ", "y", "e", "t"] → 0 ["b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] → 0 ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] → 26 ["r", "n", "h", "d", "u", "o", "t", "g", "m", "b", "e", "i", "z", "w", "s", "f", "k", "y", "q", "a", "p", "v", "c", "j", "l", "x"] → 26 ["t", "h", "e", " ", "q", "u", "i", "c", "k", " ", "b", "r", "o", "w", "n", " ", "f", "o", "x", " ", "j", "u", "m", "p", "s", " ", "o", "v", "e", "r", " ", "t", "h", "e", " ", "l", "a", "z", "y", " ", "d", "o", "g"] → 32 ["a", " ", "q", "u", "i", "z", "z", "i", "c", "a", "l", " ", "r", "o", "m", "a", "n", "t", "i", "c", " ", "n", "i", "g", "h", "t", " ", "w", "i", "t", "h", " ", "e", "x", "p", "e", "r", "t", "s", " ", "t", "h", "r", "o", "u", "g", "h", " ", "t", "h", "e", " ", "h", "i", "l", "l", "s", " ", "a", "n", "d", " ", "v", "a", "l", "l", "e", "y", "s", " ", "j", "u", "s", "t", " ", "f", "e", "e", "l", "s", " ", "b", "l", "e", "a", "k", "e", "r", " ", "a", "n", "d", " ", "q", "u", "e", "e", "r", "e", "r", " ", "t", "h", "a", "n", " ", "b", "e", "f", "o", "r", "e"] → 72
Par: Ruby, 119b