[C++] Using Union-Find.
\nvector<int> parent(26);\nint unionn(int node)\n{   \n    while(parent[node]!=node)               //finding parent or Lexicographically Smallest equivalent cha
```\nvector<int> parent(26);\nint unionn(int node)\n{   \n    while(parent[node]!=node)               //finding parent or Lexicographically Smallest equivalent character\n        node=parent[node];\n    \n    return node;  \n}\nclass Solution {\npublic:\n    string smallestEquivalentString(string A, string B, string S) {\n\n        for(int i=0;i<26;i++)                    //intialising\n          parent[i]=i;                      \n        \n        for(int i=0;i<A.size();i++)\n        {\n            int x=unionn(A[i]-\'a\');\n            int y=unionn(B[i]-\'a\');\n            \n            if(x!=y)\n            {\n                parent[max(x,y)]=min(x,y);            //making sure that parent is always Lexicographically Small\n            }\n        }\n        \n        string s;\n        for(auto i:S)\n            s.push_back(unionn(i-\'a\')+\'a\');            //pushing parent of every character of S\n        \n        return s;\n    }\n};\n```
[]