✅✅Easy C++ Solution || Simple to Understand
\tclass Solution {\n\tpublic:\n\t\tstring sortString(string s) {\n\n\t\t\tunordered_map mp;\n\n\t\t\tfor(auto i : s){\n\t\t\t\tmp[i]++;\n\t\t\t}\n\n\t\t\tstring
\tclass Solution {\n\tpublic:\n\t\tstring sortString(string s) {\n\n\t\t\tunordered_map<char, int> mp;\n\n\t\t\tfor(auto i : s){\n\t\t\t\tmp[i]++;\n\t\t\t}\n\n\t\t\tstring ans = "";\n\n\t\t\tbool found = true;\n\t\t\twhile(found){\n\n\t\t\t\tfound = false;\n\t\t\t\t// For steps 1,2,3\n\t\t\t\tfor(char c=\'a\' ; c<=\'z\' ; c++){\n\t\t\t\t\tif(mp[c]){\n\t\t\t\t\t\tans.push_back(c);\n\t\t\t\t\t\tmp[c]--;\n\t\t\t\t\t\tfound= true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// For steps 4,5,6\n\t\t\t\tfor(char c=\'z\' ; c>=\'a\' ; c--){\n\t\t\t\t\tif(mp[c]){\n\t\t\t\t\t\tans.push_back(c);\n\t\t\t\t\t\tmp[c]--;\n\t\t\t\t\t\tfound= true;                    \n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ans;\n\t\t}\n\t};\nI hope that you\'ve found the solution useful.\nIn that case, please do upvote. Happy Coding :)
['C', 'C++']