89% - java solution - simple and easy to understand solution
 # Intuition  \n\n\n# Approach\n\n1. Create int array for alphabets of length 26.\n2. Put the character frequency by iterating the input string.\n3. Run 2 loops
<!-- # Intuition -->\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. Create int array for alphabets of length 26.\n2. Put the character frequency by iterating the input string.\n3. Run 2 loops (forward and reverse) and store the non zero number (character) in a string builder and decrement its frequency.\n4. Convert and print the string.\n\n\n<!-- # Complexity -->\n<!-- - Time complexity: -->\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n<!-- - Space complexity: -->\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public String sortString(String s) {\n        int[] arr = new int[26];\n\n        for(int i=0; i<s.length(); i++){\n            int index = s.charAt(i)-\'a\';\n            arr[index] = arr[index]+1;\n        }\n\n        // System.out.print(Arrays.toString(arr));\n\n        StringBuilder sb = new StringBuilder();\n        while(sb.length() < s.length()){\n        \n        for(int i=0; i<26; i++){\n            if (arr[i]>0){\n                char ch = (char)(\'a\'+i);\n                sb.append(ch);\n                arr[i]--;\n            }\n        }\n\n        for(int i=25; i>=0; i--){\n            if (arr[i]>0){\n                char ch = (char)(\'a\'+i);\n                sb.append(ch);\n                arr[i]--;\n            }\n        }\n\n        }\n\n        return sb.toString();\n    }\n}\n```
['Java']