用到了向量和pair。
class Solution {
public:string reverseVowels(string s) {
vector<pair<char,int>> vec;
for (int i = 0;i<s.size();i++)
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'){
pair<char,int> tmp;
tmp.first = s[i];
tmp.second = i;
vec.push_back(tmp);
}
for (int i = 0;i<vec.size();i++)
s[vec[i].second] = vec[vec.size() - 1 - i].first;
return s;
}
};