Shift Families
Shifting a word moves every one of its letters forward by the same number of places in the alphabet, wrapping around from z to a: shifting "abc" by 1 gives "bcd", and shifting "xyz" by 3 gives "abc". Two words belong to the same family when one is a shift of the other; a shift by 0 counts, so equal words are in the same family, and words of different lengths never are.
Group the words of words into families and return them as a list of lists: each family sorted alphabetically (duplicates kept), and the families ordered by their first word. The empty list gives [].
Example 1
abc, bcd and xyz are shifts of each other; so are az and ba (shift by 1); a and z are one-letter words, which are always shifts of each other; acef is alone. Families are listed by their first word: a, abc, acef, az.
Example 2
The two copies of cat stay together; dog is not a shift of cat.
Constraints
0 <= len(words) <= 1001 <= len(words[i]) <= 10- words have lowercase letters only
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.