Very simple C++ solution
\nclass Solution {\npublic:\n    string sortString(string s) {\n        string res="";\n        int n=s.length();\n        vector<int> count(26,0);\n        for
```\nclass Solution {\npublic:\n    string sortString(string s) {\n        string res="";\n        int n=s.length();\n        vector<int> count(26,0);\n        for(auto ch: s){\n            count[ch-\'a\']++;\n        }\n        while(n>res.size()){\n            for(int i=0;i<26;i++){\n                if(count[i]>0){\n                    res+=i+\'a\';\n                    count[i]--;\n                }\n            }\n            for(int j=25;j>=0;j--){\n                if(count[j]>0){\n                    res+=j+\'a\';\n                    count[j]--;\n                }\n            }\n        }\n        return res;\n    }\n};\n```
[]