Very Easy Java Solution
\nclass Solution {\n    public String sortString(String s) {\n        \n        //Declaring the result String\n        StringBuilder result=new StringBuilder(""
```\nclass Solution {\n    public String sortString(String s) {\n        \n        //Declaring the result String\n        StringBuilder result=new StringBuilder("");\n        \n        //taking counter letterCount for iterating over the loop\n        int letterCount=s.length();\n        \n        //Counting the frequency of the letters  using array;\n        int letterFrequency[]=new int[26];\n        Arrays.fill(letterFrequency,0);\n        for(int i=0;i<s.length();i++){letterFrequency[s.charAt(i)-\'a\']++;}\n        \n        //iterating the loop for numberOfLetters present in the String\n        while(letterCount>0){\n            \n            //iterating for the steps 1-2-3 i.e taking the string for the last \n            for(int i=0;i<letterFrequency.length;i++){\n                \n                if(letterFrequency[i]!=0){\n                    result.append((char)(i+97));\n                    letterFrequency[i]--;\n                    letterCount--;\n                }\n            }\n            \n            //iterating for the step 4-5-6 i.e taking the string from the last\n            for(int i=letterFrequency.length-1;i>=0;i--){\n                if(letterFrequency[i]!=0){\n                    result.append((char)(i+97));\n                    letterFrequency[i]--;\n                    letterCount--;\n                }\n            }\n        }\n        \n        //converting the StringBuilder to String Using toString() function\n        return result.toString();\n    }\n}\n```
['Java']