c++的string有一个find()函数,返回匹配的索引
s="aeiou"
s.find(a)
class Solution {
public:
string reverseVowels(string s) {
int i = 0,j=s.size()-1;
string change="aeiouAEIOU";
while(i<j){
while(change.find(s[i])==-1&&i<j) i++;
while(change.find(s[j])==-1&&i<j) j--;
if(i<j) swap(s[i++],s[j--]);
}
return s;
}
};