a = 'aabbcc'
b = 112233
z = sorted(zip(str(a), str(b)))
x = all(gx == g0 for k, g in itertools.groupby(z, key=lambda x: x[0]) for
    gx in g for g0 in g)
print(x)
Find possible bijection between characters and digits