Js/ts easy solution
Js/ts easy solution.\n\n\n# Code\n\nfunction smallestEquivalentString(s1: string, s2: string, baseStr: string): string {\n    const alphabet = Array.from(\'abcd
Js/ts easy solution.\n\n\n# Code\n```\nfunction smallestEquivalentString(s1: string, s2: string, baseStr: string): string {\n    const alphabet = Array.from(\'abcdefghijklmnopqrstuvwxyz\');\n\n    const graph = alphabet.reduce((acc,cur) => {\n        acc[cur] = new Set([cur])\n        return acc\n    }, {}) \n\n    const connect = (a: string, b: string) => {\n        for (const x of graph[a]) {\n            for (const y of graph[b]) {\n                graph[x].add(y)\n                graph[y].add(x)\n            }\n        }\n    }\n\n    for (let i =0; i< s1.length; i++) {\n        connect(s1[i], s2[i])\n    }\n\n    return Array.from(baseStr).map((c)=> [...graph[c]].sort()[0]).join(\'\')\n\n};\n```
['TypeScript', 'JavaScript']