Description

Submission
class Solution {
public:
    string reverseVowels(string s) {
        vector<int> pos;
        vector<int> vowel;
        string vowels = "aeiouAEIOU";
        for(int i = 0; i < s.length(); ++i) {
            char ch = s[i];
            if(find(vowels.begin(), vowels.end(), ch) != vowels.end()) {
                pos.push_back(i);
                vowel.push_back(ch);
            }
        }
        reverse(vowel.begin(), vowel.end());
        for(int i = 0; i < vowel.size(); ++i) {
            s[pos[i]] = vowel[i];
        }
        return s;
    }
};
