C# Solution with Dictionary<char, List<char>>
Complexity\n- Time complexity: O(n)\n- Space complexity: O(1)\n\n\npublic class Solution {\n    public string SmallestEquivalentString(string s1, string s2, str
# Complexity\n- Time complexity: O(n)\n- Space complexity: O(1)\n\n```\npublic class Solution {\n    public string SmallestEquivalentString(string s1, string s2, string baseStr) {\n        \n        var map = new Map(s1, s2);\n        var output = map.Convert(baseStr);\n        return output;\n\n    }\n}\n\npublic class Map {\n\n    private readonly Dictionary<char, List<char>> _map = new();\n\n    public Map(string s1, string s2) {\n\n        for(int i = \'a\'; i <= \'z\'; i++) {\n            _map[(char)i] = new() { (char)i };\n        }\n\n        for(int i = 0; i < s1.Length; i++) {\n            Merge(s1[i], s2[i]);\n        }\n\n    }\n\n    public string Convert(string baseStr) {\n\n        var sb = new StringBuilder(baseStr.Length);\n\n        for(int i = 0; i < baseStr.Length; i++) {\n            var curr = GetSmaller(baseStr[i]);\n            sb.Append(curr);\n        }\n\n        return sb.ToString();\n\n    }\n\n    private char GetSmaller(char value) {\n        return _map[value].Min();\n    }\n\n    private void Merge(char one, char two) {\n\n        if(one == two) {\n            return;\n        }\n\n        var oneList = _map[one];\n        var twoList = _map[two];\n\n        var newList = oneList.Concat(twoList).Distinct().ToList();\n\n        foreach(var element in newList) {\n            _map[element] = newList;\n        }\n\n    }\n\n}\n```
['C#']