LC: 249. Group Shifted Strings - spiralgo/algorithms GitHub Wiki
The Essence:
The strings that are shifted are inherently related to each other in terms of the individual distances between their characters. If "abc" is related to "def", that is because all characters next to each other distanced from each other in the exact same way.
Details:
We can assume keys for each string, according which they are grouped, and use this for grouping. For a string like "bdf", the base can start from 'a', then build on top of it with the character distances -> "ace". As character distances can sometimes be negative, it's important to take modulo 26 of characters for safety.