问题描述
解决方案
class Solution {public: string reverseVowels(string s) { string vowels("aeiouAEIOU"); string::size_type begin=0; string::size_type end=s.size(); while(begin!=string::npos) { begin=s.find_first_of(vowels,begin); end=s.find_last_of(vowels,end); if(begin>=end) break; swap(s[begin],s[end]); ++begin; --end; } return s; }};