Sort Vovel In String
Intuition\n Describe your first thoughts on how to solve this problem. \nIn this problem we have to sort the vovel w.r.t there ascii value.\nSo just count and s
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nIn this problem we have to sort the vovel w.r.t there ascii value.\nSo just count and store the vovel in one traverse and in second traverse substitute the stored vovel.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. We know total vovel is 10(small + capital), so we created an array of integer initialized with 0 .\n2. Now traverse the input string:\n   2.1 if it is vovel \n        then increase respective count\n\nTill now we have array which store just the count of each vovel.\n\n3. now take a char array which store all vovel.\n4. Now its time to traverse again the original string:\n   4.1 if it is vovel \n        then find the index of count array whoose count is not zero;\n        sustitue the s[i] with vovel [index]\n        decrease the count of that vovel.\n5. return string s;\n        \n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nFirst traverse - O(N)\nSecond traverse - O(N)\n**Note**: Don\'t confuse with the inner while loop because it does not depend on input. It will run maximum of 10 times in any case, so it will be considered as constant time.\n\nso the time complexity will be O(2N) ~ O(N)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nIn this code two aditional array is used one is to count the array and second is to store the character both is of size 10.\n\nso auxilary space would be- \u0398(10).\n\nI hope this heps you understand.\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    bool isVoval(char c){\n        if(c==\'a\'||c==\'e\'||c==\'i\'||c==\'o\'||c==\'u\'||c==\'A\'||c==\'E\'||c==\'I\'||c==\'O\'||c==\'U\'){\n            return 1;\n        }\n        return 0;\n    }\n    string sortVowels(string s) {\n        int a[10]={0};\n        \n        for(int i=0;i<s.length();i++){\n            if(isVoval(s[i])){\n                if(s[i]==\'A\') a[0]++;\n                else if(s[i]==\'E\') a[1]++;\n                else if(s[i]==\'I\') a[2]++;\n                else if(s[i]==\'O\') a[3]++;\n                else if(s[i]==\'U\') a[4]++;\n                else if(s[i]==\'a\') a[5]++;\n                else if(s[i]==\'e\') a[6]++;\n                else if(s[i]==\'i\') a[7]++;\n                else if(s[i]==\'o\') a[8]++;\n                else if(s[i]==\'u\') a[9]++;\n            }\n        }\n        char vovel[10]={\'A\',\'E\',\'I\',\'O\',\'U\',\'a\',\'e\',\'i\',\'o\',\'u\'};\n        int j=0;\n        for(int i=0;i<s.length();i++){\n            if(isVoval(s[i])){\n                while(a[j]==0){\n                    j++;\n                }\n                s[i]=vovel[j];\n                a[j]--;\n            }\n        }\n        return s;\n    }\n};\n```
['String', 'C++']