python, using a list of sets (Runtime: 38 ms, faster than 96.55%)
https://leetcode.com/submissions/detail/877788150/  \nRuntime: 38 ms, faster than 96.55% of Python3 online submissions for Lexicographically Smallest Equivalent
https://leetcode.com/submissions/detail/877788150/  \nRuntime: **38 ms**, faster than 96.55% of Python3 online submissions for Lexicographically Smallest Equivalent String.  \nMemory Usage: 13.9 MB, less than 56.90% of Python3 online submissions for Lexicographically Smallest Equivalent String.  \n```\nclass Solution:\n    def smallestEquivalentString(self, s1: str, s2: str, baseStr: str) -> str:\n        relations, d = [], dict() ## "relations" is a list of sets\n        \n        for c1,c2 in zip(s1,s2):\n            if c1==c2: continue\n            i1, i2 = None, None\n            for i,r in enumerate(relations):\n                if c1 in r or c2 in r:\n                    if i1 is not None: ## two sets have the same character\n                        i2 = i\n                        relations[i1].update(r) ## merge the 2nd set to the 1st one\n                        break\n                    i1 = i\n                    r.update((c1, c2))\n            if i2 is not None:  ## delete the 2nd set\n                relations = relations[:i2] + relations[i2+1:]\n            if i1 is None:\n                relations.append({c1, c2})\n\n        for r in relations: ## convert to a dictionary so it is easier to work with\n            l = sorted(r)\n            for c in l:\n                d[c] = l[0]\n                \n        return \'\'.join([d[c] if c in d else c for c in baseStr])\n```\n\n**Test cases**  \n```\n"parker"\n"morris"\n"parser"\n"hello"\n"world"\n"hold"\n"leetcode"\n"programs"\n"sourcecode"\n"aabbbabbbbbabbbbaabaabbaaabbbabaababaaaabbbbbabbaa"\n"aabbaabbbabaababaabaababbbababbbaaaabbbbbabbbaabaa"\n"buqpqxmnajphtisernebttymtrydomxnwonfhfjlzzrfhosjct"\n"dfeffdfafbbebbebacbbdfcfdbcacdcbeeffdfebbdebbdafff"\n"adcdfabadbeeafeabbadcefcaabdecabfecffbabbfcdfcaaae"\n"myickvflcpfyqievitqtwvfpsrxigauvlqdtqhpfugguwfcpqv"\n```
['Ordered Set', 'Python']