Easy C++ Solution
Approach\n Describe your approach to solving the problem. \n1. Created 26 size vector to store corresponding equal character.\n2. Assigned same Character Initai
# Approach\n<!-- Describe your approach to solving the problem. -->\n1. Created 26 size vector to store corresponding equal character.\n2. Assigned same Character Initaially.\n3. Inside loop of `s1.length()` Finding both char position and putting value of min in max among them position.\n4. Performed Same Operation on `baseStr` and returned new `baseStr`.\n\n\n# Complexity\n- Time complexity: $$O(max(s1.length(),baseStr.length()))$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int abc(int i,vector<int>& p){\n        if(i==p[i]) return i;\n        p[i] = abc(p[i],p);\n        return p[i];\n    }\n    string smallestEquivalentString(string s1, string s2, string baseStr) {\n        vector<int> p(26,0);\n        for(int i=0;i<26;i++) p[i]=i;\n        for(int i=0;i<s1.length();i++){\n            int x = abc(s1[i]-\'a\',p);\n            int y = abc(s2[i]-\'a\',p);\n            p[max(x,y)] = min(x,y);\n        }\n        for(int i=0;i<baseStr.length();i++){\n            baseStr[i]=abc(baseStr[i]-\'a\',p)+\'a\';\n        }\n        return baseStr;\n    }\n};\n```\n\n---\n\n\n# **`--------------------------Don\'t Forget to UpVote.--------------------------`**
['C++']