C++ ||Begineer Friendly|| Easy-Understanding||Union-find|| Video solution
Intuition\n Describe your first thoughts on how to solve this problem. \nC++ Clear Explaination ,Please support if you find it usefull. Can give me feedback in 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n**C++ Clear Explaination ,Please support if you find it usefull. Can give me feedback in comment for improvement.,will be very thankfull.**\nhttps://www.youtube.com/watch?v=1qgxjQ0Bd7M/\n\n\n# Complexity\n- Time complexity:\n  (n+m)O(log(n))\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n  O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n vector<int>headChar;\n\n// find the parent or headChar.\n    int find(int x){\n        if(headChar[x] == -1){return x;}\n\n        return headChar[x] = find(headChar[x]);\n    }\n\n    void Union(int x,int y){\n        int parentx = find(x);\n        int parenty = find(y);\n\n\n        if(parentx == parenty){return;}\n\n\n        // make smaller one represent of other. if parent are diffrent.\n        headChar[max(parentx,parenty)] = min(parentx,parenty);\n    }\n\n\n    string smallestEquivalentString(string s1, string s2, string baseStr) {\n\n        headChar.resize(26,-1);\n        // make group (Union)\n        for(int i=0;i<s1.size();i++){\n            Union(s1[i]-\'a\',s2[i]-\'a\');\n        }\n\n        // traverse in the baseStr and find the parent of each char.\n       for(auto i=0;i<baseStr.size();i++)\n            baseStr[i]=find(baseStr[i]-\'a\')+\'a\';\n\n        return baseStr;\n    }\n};\n```
['Array', 'String', 'Depth-First Search', 'Union Find', 'C++']