https://leetcode.com/problems/reverse-vowels-of-a-string/description/
class Solution {
public:
bool isVowel(char c)
{
if( c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U')
return true;
return false;
}
string reverseVowels(string s) {
int left = 0, right = s.size()-1;
while (left<right) {
if(isVowel(s[left])&&isVowel(s[right])){
swap(s[left], s[right]);
left++; right--;
}
else if(!isVowel(s[left])&&isVowel(s[right])){
left++;
}
else if (isVowel(s[left])&&!isVowel(s[right])){
right--;
}
else{
left++; right--;
}
}
return s;
}
};