C++ || JAVA || PYTHON || 2785. Sort Vowels in a String
Complexity\n- Time complexity:O(nlogn)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(n)\n Add your space complexity here, e.g. O(n) \n\n# 
# Complexity\n- Time complexity:$$O(nlogn)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    public String sortVowels(String s) {\n        ArrayList<Character> vs = new ArrayList<>();\n        int n=s.length();\n        for(int i=0;i<n;i++){\n            if(s.charAt(i)==\'a\'||s.charAt(i)==\'e\'||s.charAt(i)==\'i\'||s.charAt(i)==\'o\'||s.charAt(i)==\'u\'||s.charAt(i)==\'A\'||s.charAt(i)==\'E\'||s.charAt(i)==\'I\'||s.charAt(i)==\'O\'||s.charAt(i)==\'U\'){\n                \n                char currentChar = s.charAt(i);\n                vs.add(s.charAt(i));\n            }\n        }\n        Collections.sort(vs);\n        StringBuilder result = new StringBuilder(s);\n        int x=0;\n        for(int i=0;i<n;i++){\n            if(s.charAt(i)==\'a\'||s.charAt(i)==\'e\'||s.charAt(i)==\'i\'||s.charAt(i)==\'o\'||s.charAt(i)==\'u\'||s.charAt(i)==\'A\'||s.charAt(i)==\'E\'||s.charAt(i)==\'I\'||s.charAt(i)==\'O\'||s.charAt(i)==\'U\'){\n                \n                result.setCharAt(i, vs.get(x++));\n            }\n        }\n        return result.toString();\n        \n    }\n}\n```\n```c++[]\nclass Solution {\npublic:\n    string sortVowels(string s) {\n        vector<char> vs;\n        int n=s.size();\n        for(int i=0;i<n;i++){\n            if(s[i]==\'a\'||s[i]==\'e\'||s[i]==\'i\'||s[i]==\'o\'||s[i]==\'u\'||s[i]==\'A\'||s[i]==\'E\'||s[i]==\'I\'||s[i]==\'O\'||s[i]==\'U\'){\n                vs.push_back(s[i]);\n            }\n        }\n        sort(vs.begin(),vs.end());\n        int x=0;\n        for(int i=0;i<n;i++){\n            if(s[i]==\'a\'||s[i]==\'e\'||s[i]==\'i\'||s[i]==\'o\'||s[i]==\'u\'||s[i]==\'A\'||s[i]==\'E\'||s[i]==\'I\'||s[i]==\'O\'||s[i]==\'U\'){\n                s[i]=vs[x++];\n            }\n        }\n        return s;\n    }\n};\n```\n```python []\nclass Solution(object):\n    def sortVowels(self, s):\n        s=list(s)\n        vs=[]\n        n=len(s)\n        for i in range(n):\n            if(s[i]==\'a\' or s[i]==\'e\' or s[i]==\'i\' or s[i]==\'o\' or s[i]==\'u\' or s[i]==\'A\' or s[i]==\'E\' or s[i]==\'I\' or s[i]==\'O\' or s[i]==\'U\'):\n                vs.append(s[i])\n        vs.sort()\n        x=0\n        res=""\n        for i in range(n):\n            if(s[i]==\'a\' or s[i]==\'e\' or s[i]==\'i\' or s[i]==\'o\' or s[i]==\'u\' or s[i]==\'A\' or s[i]==\'E\' or s[i]==\'I\' or s[i]==\'O\' or s[i]==\'U\'):\n                res=res+vs[x]\n                x+=1\n            else:\n                res=res+s[i]\n        return res\n```\n
['String', 'C', 'Sorting', 'Python', 'C++', 'Java', 'Python3']