[c++]  solution easy to understand ,Runtime: 4 ms, faster than 98.52%  Memory Usage: 7.7 MB
Resources: https://github.com/AJAYKR00KJ/LeetCode_Solution\n\nTime Complexity: O( N * 2 * 26 ) = O(N)  for very large N\nSpace Complexity: O ( 52 ) = constant s
***Resources: https://github.com/AJAYKR00KJ/LeetCode_Solution***\n\n**Time Complexity: O( N * 2 * 26 ) = O(N)  for very large N**\n**Space Complexity: O ( 52 ) = constant space**\n```\nclass Solution {\npublic:\n    string sortString(string s) {\n        string res="";\n        int a[26]={0},k=0;\n        for(int i=0;i<s.length();i++)\n        {a[s[i]-\'a\']++;k++;}\n        while(k)\n        {\n            for(int i=0;i<26;i++)\n            {\n                if(a[i]>0) { res+=i+\'a\';k--;a[i]--;}\n            }\n            for(int i=25;i>=0;i--)\n            {\n                if(a[i]>0) { res+=i+\'a\';k--;a[i]--;}\n            }\n        }\n        \n        \n        return res;\n        \n    }\n};\n```
['C', 'C++']