JAVA 2ms((100%), easy to understand
\nclass Solution {\n    public String sortString(String s) {\n        int len = s.length();\n        int n[] = new int[26];\n        for(int i=0; i<len; i++)n[s
```\nclass Solution {\n    public String sortString(String s) {\n        int len = s.length();\n        int n[] = new int[26];\n        for(int i=0; i<len; i++)n[s.charAt(i)-\'a\']++;\n        \n        char x[] = new char[len]; int ind=0;\n        \n        while(ind<len){\n            for(int i=0; i<26; i++) if(n[i]>0){x[ind++]=(char)(i+\'a\'); n[i]--;}\n            for(int i=25; i>=0; i--)if(n[i]>0){x[ind++]=(char)(i+\'a\'); n[i]--;}\n        }\n        return new String(x);\n    }\n}\n```
[]