Java | easy to understand
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public String smallestEquivalentString(String s1, String s2, String baseStr) {\n        char c[]=new char[26];\n        for(int i=0;i<26;i++)\n        {\n            c[i]=(char)(\'a\'+i);\n        }\n        for(int i=0;i<s1.length();i++)\n        {\n            char min_char=\'a\';\n            char max_char=\'a\';\n            if(c[s1.charAt(i)-\'a\']>c[s2.charAt(i)-\'a\']){\n               min_char=c[s2.charAt(i)-\'a\'];\n               max_char=c[s1.charAt(i)-\'a\'];\n            }else{\n               max_char=c[s2.charAt(i)-\'a\'];\n               min_char=c[s1.charAt(i)-\'a\']  ;\n            }\n            \n            for(int j=0;j<26;j++)\n            {\n                if(c[j]==max_char)c[j]=min_char;\n            }\n        }\n        String res="";\n        System.out.println(Arrays.toString(c));\n        for(char ch:baseStr.toCharArray())\n        {\n            res+=c[ch-\'a\'];\n        }\n\n        return res;\n   }\n}\n\n```
['Java']