'''
keys: 
Solutions:
Similar: 
T:
S:
'''
from typing import List


class Solution:
    def groupStrings(self, strings: List[str]) -> List[List[str]]:
        '''
        Consider acf and pru. Now notice the differnce between each 
        characters. acf = 0->2->3, and pru = 0->2->3. So these two form 
        same group.
        '''
        hashmap = {}
        for s in strings:
            key = ()
            for i in range(len(s) - 1):
                circular_diff = ord(s[i+1]) - ord(s[i])
                key += (circular_diff % 26)
            hashmap[key] = hashmap.get(key, []) + [s]
        return list(hashmap.values())