✅ 🔥 14 ms Runtime Beats 65% User Confirm 🔥ll Step By Step Solution ✅ ll Beginner Friendly ✅ ll
Intuition
Select the vowel
sort the vowel
insert at correct position
Approach
we will create 2 array or vectors to store the count of vowels
we will count all t
# Intuition
1. Select the vowel
2. sort the vowel 
3. insert at correct position
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
1. we will create 2 array or vectors to store the count of vowels 
2. we will count all the vowels and increase its count if found .
and we will put a **'#'** over there to easly find and replace at the end.
3. we will sort the upperCase first then lowwerCase .
4. now search for**"#"** and put the vowel at its place ..
here we will use two pointers **"First" &"Second"** initiallised to 0
first will point to string and second will point to vowel .
second will traverse whole vowel and replace the **#** in the string.

SEE YOU GUYS!!!

# Complexity
- Time complexity: **O[N]**
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: **O[N]**
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    string sortVowels(string s) {
        vector<int>lower(26,0);
        vector<int>upper(26,0);
        for(int i=0;i<s.size();i++){
            //selecting lower cased vowels and marking them .....
            if(s[i]=='a'|| s[i]=='e'|| s[i]=='i'|| s[i]=='o'|| s[i]=='u'){
                lower[s[i]-'a']++;
                s[i]='#';
            }
            //selecting upper cased vowels and marking them .....
            if(s[i]=='A'|| s[i]=='E'|| s[i]=='I'|| s[i]=='O'|| s[i]=='U'){
                upper[s[i]-'A']++;
                s[i]='#';
            }
        }
        string vowel;
        //Sorting vowels 
        for(int i=0;i<26;i++){
            //for Uppercase First Since there Ascii value is smaller ....
            while(upper[i]>0){
                vowel+='A'+i;
                upper[i]--;
            }
        }
            //for lowercased...
        for(int i=0;i<26;i++){
            while(lower[i]>0){
                vowel+='a'+i;
                lower[i]--;
            }
        }
        int first=0,second=0;
        while(second<vowel.size()){
            if(s[first]=='#'){
                s[first]=vowel[second];
                second++;
            }
            first++;
        }
        return s;
    }
};
```
['C++']