C++ solution runs in 4 ms
\nchar m[26];\nclass Solution {\npublic:\n    string sortString(string s) {\n        for(const char &c:s) ++m[c-\'a\'];\n        int rem = 0;\n        int len =
```\nchar m[26];\nclass Solution {\npublic:\n    string sortString(string s) {\n        for(const char &c:s) ++m[c-\'a\'];\n        int rem = 0;\n        int len = s.length();\n        int mn = 0;\n        while(rem < len && !(mn = 0))\n            for(int i = 0, j = 51; j >= 0; ++i,--j,mn = min(i,j))\n                if (m[mn]) s[rem] = mn+\'a\',++rem,--m[mn];\n        return s;\n    }\n};\n```
[]